Types of Inheritance
The derived class inherits a few or all the characteristics of the base class depending on the visibility mode and level of inheritance. A Level of inheritance refers to the length of its (derived class) path from the root (top base class). A base class itself may have been derived from other classes in the hierarchy. An Inheritance is categoriezed into the following forms based on the levels of inheritance and interrelation between the classes included in the inheritance procedure.
- Single Inheritance
- Multiple Inheritances
- Hierarchical inheritance
- Multilevel inheritance
- Hybrid Inheritance
The various forms of inheritance relationship are depicted in the given figure.
Single Inheritance Multiple Inheritance
Hierarchical Inheritance Multilevel Inheritance
Hybrid Inheritance Multipath inheritance
Single Inheritance: A Derivation of a class from just one base class is known as Single Inheritance.
Multiple Inheritance: A Derivation of a class from various base classes is known as multiple inheritance.
Hierarchical Inheritance: A Derivation of various classes from a single base class
Multilevel Inheritance: A Derivation of a class from another derived class is known as multilevel inheritance
Hybrid Inheritance: A Derivation of a class including more than one form of inheritance is known as hybrid inheritance.
Multipath inheritance: A Derivation of a class from other derived classes that are derived from the similar base class is known as multipath inheritance.