Difference Between Single and Multiple Inheritance

ProgrammingServer Side ProgrammingSoftware & Coding

In this post, we will understand the difference between single inheritance and multiple inheritance.

Single Inheritance

  • It is the one wherein the derived class inherits the single base class.

  • The derived class inherits the features of the base class.

  • It requires a small run time in comparison to multiple inheritance.

  • It has less overhead.

  • It is a generalization.

  • It is simple in comparison to multiple inheritance.

  • It can be implemented in any programming language.

Implementation:

Class DerivedClass_name : access_specifier Base_Class{};

Multiple Inheritance

  • The derived class derives from two or more base classes.

  • The derived class uses the combined features of the multiple base classes.

  • It requires more run time in comparison to single inheritance.

  • It has more overhead.

  • It is a specialization.

  • It is complex in comparison to single inheritance.

  • Only C++ supports multiple inheritance

Implementation:

Class DerivedClass_name : access_specifier Base_Class1, access_specifier Base_Class2, ….{};
raja
Published on 25-Mar-2021 05:36:03
Advertisements