In this we are going to see a program on multiple inheritance of constructor in Python Programming Language.
class A:
def __init__(self, txt):
print(txt, 'I am in A Class')
class B(A):
def __init__(self, txt):
print(txt, 'I am in B class')
super().__init__(txt)
class C(B):
def __init__(self, txt):
print(txt, 'I am in C class')
super().__init__(txt)
class D(B):
def __init__(self, txt):
print(txt, 'I am in D class')
super().__init__(txt)
class E(D, C):
def __init__(self):
print( 'I am in E class')
super().__init__('hello ')
# driver code
d = E()
print('')
h = C('hi')
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP