7_20 day24 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


@staticmethod#类工具包,不和类也不和实例绑定,不能调用类,实例变量
def wash_body(a, b, c):
print('%s %s %s正在洗澡' % (a, b, c))

def test(x, y):
print(x, y)

Room.wash_body('alex','yuanhao','wupeiqi')
r1=Room('厕所','alex',100,100,100000)

print(Room.__dict__)
print(r1.__dict__)
posted @ 2018-07-20 07:25  一棵大树一棵小树一棵草  阅读(87)  评论(0编辑  收藏  举报