一般是类.方法或者是继承(本次不说继承)
class A(object):
def f1(self):
print(“输出5”)
class B(object):
def f1(self):
print(“输出3”)
A.f1(self)
T = B()
T.f1()

或者:
class A(object):
def f1(self):
print(“输出5”)
class B(object):
def __init__(self):
self.a = A()
def f1(self):
print(“输出3”)
self.a.f1()
T = B()
T.f1()

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
猜你喜欢
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
相关资源
相似解决方案