Hybrid Inheritance
Introduction to OOP's
Class
Object
Constructor
Instance Variables
Class Variables
Instance Methods
self Keyword
Encapsulation
Public Members
Protected Members
Private Members
Inheritance
Single Inheritance
Multiple Inheritance
Multilevel Inheritance
Hierarchical Inheritance
Hybrid Inheritance
super() Function
Polymorphism
Method Overriding
Duck Typing
Abstraction
Abstract Class
Abstract Method
Class Method
Static Method
Special Methods
_str_ Method
Operator Overloading
Composition
Aggregation
Association
Method Resolution Order
Object Class
issubclass() and isinstance()
Property Decorator
Setter Method with @property
Destructor
Inner Class
Complete Mini Example
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
Executing...
❌ Error:
✅ Output:
// Click Run ▶ to execute
🏋️ Test Yourself With Exercises
Take our quiz on Hybrid Inheritance to test your knowledge.
Browse Quizzes »