Multilevel inheritance in C++ OOP – Example program

Multilevel inheritance in C++ OOP – Example program

In this tutorial we will learn about the followings;

  1. Multilevel inheritance in C++ OOP
  2.  Example of multi-level inheritance in C++ OOP
  3. The syntax of multi-level inheritance in C++ OOP
  4. The basic program of multi-level inheritance  in C++ OOP

What is Multi-level inheritance?

A derived class can be derived from another derived class. A child class can be the parent of another class.

Give an example of multilevel inheritance?

Class C is a child of class B and class B is child class of class A.

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

What is the syntax of multilevel inheritance?

Class A


Statements of Class A


Class B: public class A


Statements of Class  b


Class C: public class B


Statements of Class  C


Basic Program of multi-level inheritance


Here in this example there is multi level inheritance because

  • Declaration of variable n1 is inherited from sum to child1 
  • Declaration of Variable n2 is inherited from chil1 to child2 
  • Child2 now uses one variable of its first parent and one variable of its grandfather.

So, this is a better example of multilevel inheritance.

Topic Covered

Multilevel inheritance in C++ OOP with example and program.

By: Prof. Fazal Rehman Shamil    CEO @
Whatsapp: +92 302 87 000 85     Facebook: For Discussions