Types Of Inheritance In Python
As we have discussed in this tutorial, that Inheritance is one of the object-oriented programming concepts. Inheritance enables classes to share and reuse the code among themselves. We can divide inheritance into different categories. Python supports the following types of inheritance,
- Single Inheritance
- Multiple Inheritance
- Multilevel Inheritance
- Hierarchical Inheritance
- Hybrid Inheritance
Single Inheritance
Single Inheritance is the simplest model of inheritance with the parent-child relationship.
![]() |
Single Inheritance |
Multiple Inheritance
Multiple inheritance model allows a child class to have more than one parent class.
![]() |
Multiple inheritance model |
Multilevel Inheritance
Multilevel inheritance model enables to create subclasses of a subclass, it means a class may have grandparent classes.
![]() |
Multi-level inheritance Model |
Hierarchical inheritance
The hierarchical inheritance model allows declaring more than one subclass of a superclass.
Hybrid inheritance
Hybrid inheritance is a complex inheritance model, which is created when more than one model of inheritance is used to create the class hierarchy. In the diagram below, this is a mixture of multiple and hierarchical inheritance models.
![]() |
Hybrid Inheritance model |
Let's consider the following example,