没有接口如何实现多重继承? [英] How to achieve multiple inheritance without interfaces?
本文介绍了没有接口如何实现多重继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以解释一下,
如何在C#中实现没有接口的多重继承....
Could anyone please explain,
How to achieve multiple inheritance without interfaces in C#.....
推荐答案
在此处阅读
C#的模拟多重继承模式 [
Have a read here
Simulated Multiple Inheritance Pattern for C#[^]
That''s a bit of a hack though
A class can only inherit from one class in c#. You could inherit multiple classes if you liked by building an inheritance chain, but you can''t do it all at once.
e.g iDB2Command inherits from Component
public sealed class iDB2Command : Component, IDbCommand, IDisposable
...which inherits from MarshalByRefObject
public class Component : MarshalByRefObject, IComponent, IDisposable
...which inherits from Object
这篇关于没有接口如何实现多重继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文