Python面向对象之静态方法和类方法浅析

例子展现: # coding=utf-8 class A(object): def __init__(self, x=0): self.x = x #类实例方法 # 最多见的实例方法 def foo(self, y=0): print self.x, y #类方法 # cls即为类自身 @classmethod
相关文章
相关标签/搜索