If all you want to do is call the super class method doSomething
on b
, this should suffice:
class A(object):
def doSomething(self):
print('Do something in A')
class B(A):
def doSomething(self):
print('Do something in B')
b = B()
super(B, b).doSomething()
Which prints:
Do something in A
The idea of "type casting" isn't really applicable in python.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…