Inheritance:

Inheritance is the process, by which class can acquire the properties and methods of another class.

The mechanism of deriving a new class from an old class is called inheritance.

The new class is called derived class and old class is called base class.

The derived class may have all the features of the base class and the programmer can add new features to the derived class.

Types of inheritance

(1)Single Inheritance

If a class is derived from a single class then it is called singleinheritance.

Class B is derived from class A

 

(2)Multilevel Inheritance

A class is derived from a class which is derived from another class then it is called multilevel inheritance

Here, class C is derived from class B and class B is derived from class A , so it is called multilevel inheritance.

(3)Multiple Inheritance:

If a class is derived from more than one class then it is called

multiple inheritance Here, class C is derived from two classes, class A and class B

(4) Hierarchical Inheritance:

If one or more classes are derived from one class then it is called

hierarchical inheritance. Here, class B , class C and class D  are derived from class A.

(5)Hybrid Inheritance:

It is a combination of any above inheritance types. That is either multiple or multilevel or hierarchical or any other combination.

Here, class B and class C are derived from class A and class D is derived from class B and class C.

class A, class B and class C is example of Hierarchical Inheritance and class B, class C and class D is example of Multiple Inheritance so this hybrid inheritance is combination of Hierarchical and Multiple Inheritance.