Types of Inheritance in Python

LEELA S
1 min readMar 10, 2022

--

The process of acquiring new property from one class to another class is called inheritance.

1)Single inheritance

When child class is derived from only one parent class is known as single inheritance.

Example:

Child inherits quality from parent

Parent class -> Child class

2)Multiple Inheritance

When child class inherits from more than one parent class is called Multiple Inheritance

Example:

Child inherits quality from parents

Parent1 -> Child2 <- Parent2

3)Multiple Level Inheritance

When a child class becomes a parent class for another child class

Example:

Child inherits from Parents and Parents inherits from Grand parents

Grand Parent -> Parent class -> Child class

4)Hierarchial Inheritance

Hierarchical Inheritance is the right opposite of multiple inheritance. This means that there are multiple derived child classes from a single parent class.

Example:

Children inherit quality from parent

Parent class1->child class 1

Parent class1 ->child class 2

5)Hybrid Inheritance

Hybrid Inheritance is the mixture of two or more different types of inheritance. Here we can have many to many relations between parent classes and child classes with multiple levels.

Example:

Child inherits from Grand Parents and Parents

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

LEELA S
LEELA S

No responses yet

Write a response