龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > python编程 >

Python入门篇之面向对象(7)

时间:2014-10-21 11:47来源:网络整理 作者:网络 点击:
分享到:
class TestClassMethod: @classmethod def foo(cls): print 'calling class method foo()' print 'foo() is part of class:', cls.__name__

>>> class TestClassMethod:
    @classmethod
    def foo(cls):
        print 'calling class method foo()'
        print 'foo() is part of class:', cls.__name__

精彩图集

赞助商链接