C++: Inheritance|Different forms of inheritance

Multilevel inheritance

In multilevel inheritance, we have a class that is the base class of another class and at the same time, it is the derived class of another class.

* Class “B” is the base class of class “C” and at the same time is the derived class of the class “A”.

* Class “B” inherits the properties of class “A” and class “C” inherits the properties of class “B”, so indirectly class “C” inherits the properties of class “A”. Thus class “C” is also known as the indirect derived class of class “A”.

* Class “B” is the base class of class “C” and class “A” is the base class of class “B” so indirectly class “A” is the base class of class “C”. Thus class “A” is also known as the indirect base class of class “C”.

Hierarchical inheritance

In hierarchical inheritance, we have one base class and two or more derived classes. All the derived classes inherit the properties of the single base class.


Class “A” is the base class and classes “B”, “C” and “D” are the derived classes. Classes “B”, ”C” and “D” inherit the properties of the base class “A”.