class Father:

def f1(self):
print('hello')

class Son(Father):

def f1(self):
super(Son, self).f1() # super格式:(子类,对象).重写的方法
print('world')


obj = Son()
obj.f1()

相关文章:

  • 2021-11-27
  • 2021-10-20
  • 2021-07-05
  • 2021-09-15
  • 2021-10-03
  • 2021-11-22
猜你喜欢
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-10-23
  • 2021-06-30
相关资源
相似解决方案