如果D继承自B,C,而B,C继承自A。A,B,C中都定义了新的属性。在D中如何使用super传参初始化?
class A(object): def __init__(self, a): print 'init A...' self.a = a class B(A): def __init__(self, a , b): super(B, self).__init__(a) print 'init B...' self.b = b class C(A): def __init__(self, a,b,c): super(C, self).__init__(a) print 'init C...' self.c = c class D(B, C): def __init__(self, a,b,c,d): super(D, self).__init__(a,b,c) print 'init D...' self.d = d
这样不行,应该怎么做?