How to achieve multi level inheritance

Let’s begin with a simple example to achieve multi-level inheritance.

multivel child parent relationship of classes
Figure: multi-level inheritance

Example to achieve multi-level inheritance in C++

C++ program to print a hollow square or rectangle star pattern by achieving the multi-level inheritance.

Level 0 =  class a

Level 1 = class b: public a (Class b is a child of class a)

Level 2 = class c: public b (Class c is a child of class b)

C++ print hollow square star pattern multi-level inheritance.
C++ print hollow square star pattern multi-level inheritance.

Output

How to achieve multi level inheritance

Topic Covered

How to achieve multi-level inheritance?