DEV Community

Sri Raam
Sri Raam

Posted on

Inheritance: A Brief on Its Types

Based on the number of child and parent classes, inheritance can be classified into five different types. Namely:

  1. Single Inheritance
  2. Hierarchical Inheritance
  3. Multiple Inheritance
  4. Multilevel Inheritance
  5. Hybrid Inheritance

*1. Single Inheritance *
One parent class gets inherited in only one child class.

*2. Hierarchical Inheritance *
One parent class gets inherited in multiple child classes.

*3. Multiple Inheritance *
Multiple parent classes are inherited in only one. child class.

*4. Multilevel Inheritance *
One parent class is inherited by an intermediate class, which in turn is inherited by another child class.

*5. Hybrid Inheritance *
A class that has a combination of different types of classes.

Top comments (0)