本文共 231 字,大约阅读时间需要 1 分钟。
super() 函数是用于调用父类(超类)的一个方法。
class A: def add(self, x): y = x+1 print(y)class B(A): def add(self, x): super().add(x)b = B()b.add(2) # j结果:3
转载地址:http://kdctz.baihongyu.com/