Multiple inheritance in Python programming is a feature of OOP. In which an object or class can inherit characteristics and features from more than one parent object or parent class.
class cls: #'cls' is name of Class.
def fun(self):
print("This is Function of Class cls")
class cls2: #'cls2' is name of Another Class.
def fun2(self):
print("This is Function of Class cls2")
class cls3(cls,cls2): #Class 'cls3' is Child of Class 'cls' and 'cls2'.
def fun3(self):
print("This is Function of Class cls3")
obj = cls3() #'obj' is object of class 'cls3'.
obj.fun2()
obj.fun3()
obj.fun()
class cls: #'cls' is name of class.
def fun(self):
print("This is Function of class cls")
class cls2: #'cls2' is name of another class.
def fun2(self):
print("This is Function of class cls2")
class cls3: #'cls3' is name of another class.
def fun3(self):
print("This is Function of class cls3")
class cls4(cls2, cls3, cls): #class 'cls4' is Child class of class 'cls2',
def fun4(self): #'cls3' and 'cls'.
print("This is Function of class cls4")
class cls5(cls4): #class 'cls4' is Child class of class 'cls4'.
def fun5(self):
print("This is Function of class cls5")
obj = cls5() #'obj' is object of class 'cls5'.
obj.fun()
obj.fun4()
obj.fun2()
obj.fun5()
obj.fun3()
class cls:
def fun(self):
print("Iam Function of class cls")
class cls2:
def fun2(self):
print("Iam Function of class cls2")
class cls3:
def fun3(self):
print("Iam Function of class cls3")
class cls4(cls2, cls3, cls): #class 'cls4' is Child of class 'cls2',
def fun4(self): #'cls3' and 'cls'.
print("Iam Function of class cls4")
obj.fun2()
obj.fun()
obj.fun3()
class cls5(cls4): #class 'cls5' is Child of class 'cls4'.
def fun5(self):
print("Iam Function of class cls5")
obj.fun4()
obj = cls5() #'obj' is object of class 'cls5'.
obj.fun5()