Programming with Python

  1. Home
  2. Docs
  3. Programming with Python
  4. OOPs concept in Python
  5. Inheritance


Inheritance is a core feature of object oriented programming. It allows one class to inherit data or behaviour from another class and is one of the key ways in which reuse is enabled within class.

Inheritance allows features defined in one class to be inherited and reused in the definition of another class. The class from which we inherit data is known as parent class and the class which inherits the data is known as child class.


class name1: 
    body of parent class

class name2(name1):
    body of child class

There are different types of inheritance:-

  • Single inheritance:- When a child class inherits from one parent class is known as single inheritance.
  • Multilevel inheritance:- In this inheritance we have a child class which inherits parents class data and parent class inherits data of grandparent class. This is known as multilevel inheritance.
  • Multiple inheritance:- When a child class inherits data from more than one parent class is known as multiple inheritance.
  • Hierarchical inheritance:- When more than one child class inherits data of one parent class is known as hierarchical inheritance.

This is all about inheritance in python.

Was this article helpful to you? Yes No

How can we help?