+ 1
super() of super() in multiple level class inheritance
Consider class inheritance in the levels with same method: class A: def method(self): ... class B(A): def method(self): ... class C(B): def method(self): super().method() Here super().method() refers to method of class B. Is it possible to refer to method of class A directly from C?
7 Answers
+ 3
Oh sorry for not reading your code properly. You could try making another method for class C that directly calls the method from class A.
def callA(self):
A.method ()
+ 2
It still the case since C inherited A aswell as B.
objectofC.methodofA()
+ 1
you can add super(). method() in the B.Method() so when you call super(). method() of the C object it call the method of B and the latter recursively calls the method of its super class A.
0
.Amethod () ...
0
/
- 1
@Gershon, well, from an object of C?
- 1
nope method is already over written in class b