Inheritance in C++
The process of deriving a new class from an already existing class is known as inheritance.
The class that is derived is known as derived class and the class from which new class is derived is known as base class.
Most important feature of the inheritance is reusability. It means if a class is designed, compiled and tested we can utilize that class in future. We can also add extra features as per our requirements.
Types of Inheritance
(1) Single Inheritance: The process of deriving a new class from already existing class is known as single inheritance. Thus in single inheritance there is one base class and one derived class.
(2)Multiple Inheritances: The process of deriving a class from more then one base class is known as multiple inheritance. Thus in multiple inheritance there is one derived class but more then one base classes.
(3) Hierarchical Inheritance: The process of deriving more than one class from single base class is known as Hierarchical Inheritance. Thus in Hierarchical Inheritance there is one base class but more then one derived classes.
(4) Multilevel Inheritance: The process of deriving a new class from an already existing class and than again derive a new class from previously derived class is known as multilevel inheritance.
(5) Hybrid Inheritance: The combination of more than one inheritance is known as hybrid inheritance.