Types of Inheritance

In this lesson, we'll learn about the types of inheritance which includes multiple inheritance and multilevel inheritance.

Multiple Inheritance

We can inherit the base class attributes to the derived class if we want derived class to have access data members and member functions of the base class. But to inherit multiple classes data members and member functions to the derived, the concept of multiple inheritance comes in. We can inherit multiple classes as base classes separated by ,


class Derived : public Base1 , public Base2 , ...
 

Example

Let’s take the example of Vehicle and Car classes which acts as the base classes of the Honda class:

Get hands-on with 1400+ tech skills courses.