How to achieve multi level inheritance

By: Prof. Fazal Rehman Shamil

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)

Output

How to achieve multi level inheritance

Topic Covered

How to achieve multi-level inheritance?

Prof. Fazal Rehman Shamil