我有 3 个 A、B 和 D 类,如下所示
class A(object):
def test(self):
print "called A"
class B(object):
def test(self):
print "called B"
class D(A,B):
def test(self):
super(A,self).test()
inst_d=D()
inst_d.test()
----------------------------------------
Output:
called B
问题:在D.test()
,我正在打电话super(A,self).test()
。B.test()
为什么即使方法也存在也只调用A.test()
?