您可以使用__bases__
这样的
class D(A, B, C):
def foo(self):
print("foo from D")
for cls in D.__bases__:
cls().foo("D")
进行此更改后,输出将为
foo from D
foo from A, call from D
foo from B, call from D
foo from C, call from D
Python调用父方法多重继承
您可以使用__bases__
这样的
class D(A, B, C):
def foo(self):
print("foo from D")
for cls in D.__bases__:
cls().foo("D")
进行此更改后,输出将为
foo from D
foo from A, call from D
foo from B, call from D
foo from C, call from D