是一个抽象类的一种接口? [英] is an abstract class a type of interface?
本文介绍了是一个抽象类的一种接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的/ interfaces文件夹中,我放了所有接口。
In my /interfaces folder I put all my interfaces.
抽象类是一种接口吗?
推荐答案
在C#中,接口与类(甚至抽象类)不同;
In C#, interfaces are distinct from classes (even abstract classes);
- 接口只能定义API(方法签名,事件声明,属性声明),而不是实现(字段,方法体等)
- 你只能继承一个基类,但你可以实现多个接口
但它们在某些用法中有相似之处 - 例如在抽象工厂实现中使用时。
But they have similarities in some usages - for example when used in an abstract factory implementation.
这篇关于是一个抽象类的一种接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文