Doubts in Multiple inheritance in .net

若如初见. 提交于 2019-12-01 14:21:47

No, you do not break the rule. Since ClassA is an object, it does not mean that you're inheriting from 2 different classes. You're inheriting from ClassA, and thereby taking all the characteristics from the 'inheritance chain' with it.
You're not inheriting from 2 different types, since ClassA is an object.

You do not understand what multiple inheritance is. From wikipedia:

Multiple inheritance refers to a feature of some object-oriented programming languages in which a class can inherit behaviors and features from more than one superclass.

From wikipedia's entry on superclass:

A superclass, base class, or parent class is a class from which other classes are derived. The classes that are derived from a superclass are known as child classes, derived classes, or subclasses.

In your example, ClassA inherits from object. ClassB inherits from ClassA. ClassA is the superclass of ClassB. Object is not a superclass of ClassB. Your example is not multiple inheritance. There is one parent, one child.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!