[Python] python in the class function call

General is a class method or inherited (This is not to say inherited)
class A (Object):
DEF F1 (Self):
Print ( "output. 5")
class B (Object):
DEF F1 (Self):
Print ( "Output . 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()

Guess you like

Origin www.cnblogs.com/fendoudemangguoailiulian/p/11303452.html