接口是多重继承的良好替代方案吗? [英] Are interfaces a good alternative to multiple inheritance?

查看:104
本文介绍了接口是多重继承的良好替代方案吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VB.net并且好奇地看到为什么只支持单继承以及接口是否解决这个问题。



另外除了使代码更简单之外,使用多重继承有什么优点和缺点吗?



提前谢谢

解决方案

< blockquote>多重继承是一种痛苦。

有很多关于这方面的讨论:快速 Google [ ^ ]会给你超过100,000次点击。

这个我一个很好的理由: http://stackoverflow.com/questions/225929/什么是准确的多重继承问题 [ ^ ]


I use VB.net and was curious to see why there is only support for single inheritance and whether or not interfaces are a way around this issues.

Also are there any pros and cons to using multiple inheritance other then making code simpler?

Thanks in advance

解决方案

Multiple inheritance is a pain.
There is a lot of discussion of this out there: a quick Google[^] will give you over 100,000 hits.
This is a good reason: http://stackoverflow.com/questions/225929/what-is-the-exact-problem-with-multiple-inheritance[^]


这篇关于接口是多重继承的良好替代方案吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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