Python-7 多继承函数调用注意点
例:
class Base(object):
def test(self):
print("---------Base")
class A(Base):
def test(self):
print("---------A")
class B(Base):
def test(self):
print("---------B")
class C(A,B):
def test(self):
print("---------C")
c = C()
c.test() #此处所有的类中都有test()方法,是以什么顺序调用?
print(c._ mro _) #通过此方法可打印出方法调用优先级
#在所有类中尽量避免有相同的方法名