0
点赞
收藏
分享

微信扫一扫

Python小记——__call__方法

后来的六六 2022-06-21 阅读 49
class Car:
price = 100000 #定义类属性
def __init__(self, c):
self.color = c #定义实例属性
print("__init__")
def __call__(self):
print("__call__")

c = Car(4)
c() # __call__


举报

相关推荐

0 条评论