Skip to main content

Write a program to implement multiple inheritance.

· One min read
Kaustubh Kulkarni
file.py
class Class1:
def m(self):
print("In Class1")
class Class2(Class1):
def m(self):
print("In Class2")
class Class3(Class1):
def m(self):
print("In Class3")
class Class4(Class2, Class3):
pass
Class1.m(1)
Class2.m(1)
Class3.m(1)
Class4.m(1)

Output:

Output
In Class1
In Class2
In Class3
In Class2