Home Tutorials Python OOP Concepts Hybrid Inheritance
Hybrid Inheritance

Hybrid Inheritance


17. Hybrid Inheritance

Hybrid inheritance combines more than one inheritance type in the same program structure. It is a combination concept rather than a separate keyword in Python.

Syntax

class D(B, C):
    pass

Example

class A:
    def show_a(self):
        print("A")

class B(A):
    def show_b(self):
        print("B")

class C(A):
    def show_c(self):
        print("C")

class D(B, C):
    pass

obj = D()
obj.show_a()
obj.show_b()
obj.show_c()

Output

A
B
C
Example

🏋️ Test Yourself With Exercises

Take our quiz on Hybrid Inheritance to test your knowledge.

Browse Quizzes »