C++: Inheritance |Different forms of inheritance

Hybrid inheritance

Hybrid inheritance is a combination of two or more inheritances.

Example:1


A & B: single inheritance
B,C & D: Multiple inheritances

Example:2


A &B : Single inheritance
C & D : Single inheritance
B,D & E : multiple inheritance

Example:3


A,B,C: hierarchical inheritance
B,C,D : Multiple inheritances

From the above figure we have

Class “D” inherits the properties of class “A” two times firstly through class “B” and secondly through class “C”.

Multipath inheritance

When a class inherits the properties of another class through two or more different paths then, it is known as multipath inheritance.