-
Multiple inheritance is more complex than single inheritance. It can lead to new ambiguity issues and to the need for virtual inheritance.
-
Virtual inheritance imposes costs in size, speed, and complexity of initialization and assignment. It's most practical when virtual base classes have no data.
-
Multiple inheritance does have legitimate uses. One scenario involves combining public inheritance from an Interface class with private inheritance from a class that helps with implementation.
Item 40: Use multiple inheritance judiciously(Effective C++)
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:Item 41: Understand implicit interfaces and compile-time polymorphism(Effective C++)
下一篇:Item 39: Use private inheritance judiciously(Effective C++)

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
51c大模型~合集40大模型
-
C++ 继承 (inheritance)
C++ 继承. 继承 & 类的概念. 继承的重要性以及如何实现.
派生类 构造函数 #include C