pythonbook/Python高级编程/多继承.py

20 lines
401 B
Python
Raw Normal View History

2020-06-25 16:56:02 +08:00
class Base:
def __init__(self):
print('Base.__init__')
class A(Base):
def __init__(self):
super().__init__()
print('A.__init__')
class B(Base):
def __init__(self):
super().__init__()
print('B.__init__')
class C(A,B):
def __init__(self):
super().__init__() # Only one call to super() here
print('C.__init__')
print(C.__mro__)