OOP

Understanding Inheritance and Different Types of Inheritance

Story Highlights
  • Different Types of Inheritance

Inheritance

Inheritance is the process of creating a new Class, called the Derived Class, from the existing class, called the Base Class.

The “inheritance concept” can be grouped into two categories:

  • derived class (child) – the class that inherits from another class
  • base class (parent) – the class being inherited from

Different Types of Inheritance

Object-Oriented Programming (OOP) support the six different types of inheritance as given below:

  1. Single Inheritance
  2. Multi-level Inheritance
  3. Multiple Inheritance
  4. Multi-path Inheritance
  5. Hierarchical Inheritance
  6. Hybrid Inheritance
Understanding Inheritance
Different types of inheritance

1. Single Inheritance

A derived class (Derived Class) is created from a single base class (Base Class).

single inheritance

2. Multi-level Inheritance

A derived class (Derived Class 2) is created from another derived class (Derived Class 1).

3. Multiple Inheritance

A derived class (Derived Class) is created from more than one base class (Base Class 1, Base Class 2).

4. Multi-path Inheritance

Multi-path inheritance is a method of inheritance in which derivation of a class (Derived Class- D) from other derived classes (Derived Class- B, Derived Class- C) which are derived from the same base class (Base Class – A)

5. Hierarchical Inheritance

Under Hierarchical Inheritance, derived classes (Derived Class-1, Derived Class-2, Derived Class-3) are created from a single base class (Base Class)  is called Hierarchical Inheritance.

6. Hybrid Inheritance

Any combination of above three inheritances (single, multi-level and hierarchical) is called as hybrid inheritance.

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button
History Of 1st July Get ready for the ICC Men’s Cricket World Cup 2023! Yoga according to the Bhagavad Gita