多重继承重名方法调用顺序

#coding=utf-8
class base(object):
    def test(self):
        print('----base test----')
class A(base):
    def test(self):
        print('----A test----')

# 定义一个父类
class B(base):
    def test(self):
        print('----B test----')

# 定义一个子类,继承自A、B
class C(A,B):
    pass


obj_C = C()
obj_C.test()

print(C.__mro__)  # 查看继承顺序

  

                                                                   -------  知识无价,汗水有情,如需搬运请注明出处,谢谢!

原文地址:https://www.cnblogs.com/wf-skylark/p/9009343.html