c# - Interface 是否在继承链中?

标签 c# inheritance interface

网上关于Interface的说法有两种,即
语句A

Interfaces do not come in inheriting chain.

其他说法B

Interfaces can inherit other interfaces

这两个是矛盾的说法。

请告诉我哪个是正确的?

最佳答案

它们在某种程度上都是正确的。

陈述 A:接口(interface)不严格继承。如果你有一个实现接口(interface)的类,你说

base.

您不会看到接口(interface)的成员。

陈述 B:这会更好地理解为“接口(interface)可以实现其他接口(interface)”。你可以有一个实现链;但它们并不是真正的继承。

关于c# - Interface 是否在继承链中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10350543/

相关文章:

struct - 在将它作为接口(interface)传递并运行它的方法后,让你将结构恢复为它的数据类型?

java - 'instanceof' 运算符对接口(interface)和类的行为不同

Java :Interface Method's Overriding

c# - 使用 MVVM 模式从 View 模型到 WPF 中的 View 的条件绑定(bind)

c# - 如何在 C# 中的一行中编写 bool 函数?

ruby - 让 `super` 通过包含的模块调用父类

php - 如何拦截 PDO 调用?

c# - WPF 列表框项目消耗太多内存

c# - Image.FromStream 内存不足异常

C#:覆盖返回类型