class A:
def __init__(self):
self.lala = 99
def show(self):
print("A.show()"+"+ "+str(self.lala))
class B:
def __init__(self):
self.data = 45
def show(self):
print("B.show()"+"+ "+str(self.data))
class C(A,B):
def __init__(self):
B.__init__(self)
#super().__init__()
A.__init__(self)
def K(self):
A.show(self)
if __name__ == "__main__":
c = C()
c.show()
c.K()
print(C.mro())
print(C.__mro__)
Python - 多继承
最新推荐文章于 2023-10-30 22:37:48 发布