python 类方法

class C:
name='fdsa'
def __init__(self,name,age):
print('init')
self.name=name
self.age=age
@staticmethod
def test2():
print('pass')
@classmethod
def test(cls):
print('cls')
return cls.test2()
def test3(self):
return C.name



A = C('cheyunhua',59)
print(A.test())
posted @ 2019-07-04 09:14  技术颜良  阅读(194)  评论(0编辑  收藏  举报