如何模拟接口,没有多继承? [英] How to simulate multiple inheritance without interfaces?

查看:87
本文介绍了如何模拟接口,没有多继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何可以模拟在C#中的多重继承,而不使用接口。我相信,接口abilityes不打算完成这个任务。我在寻找更多的设计模式化的方式。


解决方案

ECMA-334,与教派; 8.9接口结果
...结果
接口可以使用多重继承。




因此,对于据C#(有限的)支持'多重继承'的老话,接口是官方的方式。


How can I simulate multiple inheritance in C# without using interfaces. I do believe, interfaces abilityes are not intended for this task. I'm looking for more 'design pattern' oriented way.

解决方案

ECMA-334, § 8.9 Interfaces
...
Interfaces can employ multiple inheritance.

So for as far C# (limited) support of 'multiple inheritance' goes, interfaces are the official way.

这篇关于如何模拟接口,没有多继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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