抽象界面模式
任何人都可以提供抽象接口模式的解释吗?
《N-Layered Domain-Oriented Architecture Guide with .NET 4.0》一书有这种模式的参考,但没有解释。
Can any one provide explanation of Abstract interface pattern.
The book "N-Layered Domain-Oriented Architecture Guide with .NET 4.0" has reference of this pattern, but no explanation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这意味着拥有一个接口、一个实现该接口的抽象类,然后是几个从该抽象类继承的非抽象类。在 C# 代码中:
使用此模式的优点是它结合了接口的优点(灵活性)和抽象基类的优点(共享实现)。
I believe it means having an interface, an abstract class that implements that interface and then several non-abstract classes that inherit from the abstract class. In C# code:
The advantage of using this pattern is that it combines benefits of interfaces (flexibility) with benefits of abstract base classes (sharing implementation).
抽象接口在 C# 中并不真正存在。在 C++ 中,有“纯抽象”类的概念,其中所有方法都是抽象的,因此它是一个仅定义接口的抽象类。
在 C# 中,我们有“interface”关键字,它的作用完全相同。
Abstract Interface doesn't really exist in C#. In C++ you have the notion of a "pure abstract" class, in which all methods are abstract, hence it's an abstract class that only defines an interface.
In C# we have the 'interface' keyword instead, which does the exact same thing.