class Car:
price = 100000 #定义类属性
def __init__(self, c):
self.color = c #定义实例属性
print("__init__")
def __call__(self):
print("__call__")
c = Car(4)
c() # __call__
Python小记——__call__方法
阅读 50
2022-06-21
class Car:
price = 100000 #定义类属性
def __init__(self, c):
self.color = c #定义实例属性
print("__init__")
def __call__(self):
print("__call__")
c = Car(4)
c() # __call__
相关推荐
精彩评论(0)