7_20 day 25 13min类方法

class Room:
tag = 1

def __init__(self, name, owner, width, length, heigh):
self.name = name
self.owner = owner
self.width = width
self.length = length
self.heigh = heigh

def test(self):
print('from test', self.name)

@classmethod
def tell_info(cls, x):
print(cls)
print('--》', cls.tag, x)

Room.tell_info(10)
posted @ 2018-07-20 07:10  一棵大树一棵小树一棵草  阅读(96)  评论(0编辑  收藏  举报