解释Real Secnario我们在哪里使用Abstract类和接口 [英] Explain Real Secnario Where we use Abstract class and interface

查看:80
本文介绍了解释Real Secnario我们在哪里使用Abstract类和接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解释真实场景我们在哪里使用Abstract类和接口

Explain Real Scenario Where we use Abstract class and interface

推荐答案

请参见
抽象类Vs接口 [抽象类与接口 [何时需要接口/抽象类? [
See
Abstract Class Vs Interface[^]
Abstract Class versus Interface[^]
When I need Interface/Abstract Class?[^]



我将描述一些用法示例:
1-接口:您需要从多个实体继承一个类,而不是一个.由于C#不支持第一个,因此您需要从接口和仅一个类继承:
Hi,
I am going to describe some samples of their usage:
1- Interface : You need to inherit a class from multiple entities rather than one. As C# does not support the first one, You need to inherit from interfaces and only one class:
public class Test: Iinterface1, Iinterface2,class1


2-接口用于Web服务和WCF服务
3-无法实现接口,因此它们只是用于强制实施层次结构以实现签名的签名
4-抽象类是基类(如果已实现),以使层次结构具有某些功能并可以自己实现其中的一些功能.

希望对您有所帮助,
欢呼声


2- Interfaces are used in Web Services and WCF Services
3- Interfaces can not be implemented so they are just signatures to enforce hierarchies to implement a signature
4- Abstract classes are base classes(if implemented ) to let the hierarchy to have some functionality and may implement some of them themselves.

I hope it will help,
Cheers


检查我的答案


这篇关于解释Real Secnario我们在哪里使用Abstract类和接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆