Python Method overriding, does signature matter?

后端 未结 6 1148
轮回少年
轮回少年 2020-12-04 15:11

Lets say I have

class Super():
  def method1():
    pass

class Sub(Super):
  def method1(param1, param2, param3):
      stuff

Is this corr

6条回答
  •  误落风尘
    2020-12-04 15:45

    Yes. Calls to "method1" will always go to the subclass. Method signature in Python only consist of the name and not the argument list.

提交回复
热议问题