class A(object): def __init__(self,a): print 'init A...' self.a = a print self.a class B(A): def __init__(self,a): print 'init B...' super(B,self).__init__(a) print self.a class C(A): def __init__(self,a): print 'init C...' super(C,self).__init__(a) class D(B,C): def __init__(self,a): print 'init D...' super(D,self).__init__(a) print self.a a = A('a') b = B('b')
为什么实例化对象a输出的结果也是b???
慕后端2583565
相关分类