I have some class structure like this:
class A:
def __init__(self):
print("A")
class B:
def __init__(self, x):
print("B")
class C(A,B):
def __init__(self):
super(C, self).__init__() # ???
c=C()
As you can see, A
and B
both are parent class of C
. I want to call both classes __init__
in C
's __init__
. I want to pass some parameter to B's __init__
. Is there any way I can do this with super
keyword? I think that this will work:
class C(A,B):
def __init__(self):
A.__init__()
B.__init__(5)
Should we call __init__
directly in such a way, or is there any better solution for this?