Python inheritance - how to call grandparent method?

后端 未结 2 1992
情深已故
情深已故 2021-02-11 19:12

Consider the following piece of code:

class A:
  def foo(self):
    return \"A\"

class B(A):
  def foo(self):
    return \"B\"

class C(B):
  def foo(self):
            


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-11 19:53

    Calling a parent's parent's method, which has been overridden by the parent There is an explanation in this discuss already on how to go back in the tree.

提交回复
热议问题