Python基础语法(十二)--对象之多继承



"""
    多继承
        1 可以让子类继承多个父类的方法还有属性
        2 多继承需要注意对象调用的顺序
        __mro__ 查询对象调用的顺序
"""
class A:
    def test(self):
        print("---A---")

class B:
    def test(self):
        print("---b---")

class C(B, A):
    def test1(self):
        print("---c---")

c = C()
c.test()

# 使用方法查询C类对象的调用顺序
print(C.__mro__)