Python类

python中类的定义

class Man(object):
    def __init__():
        print 'Man init'
        pass
    @staticmethod
    def speak():
        print 'speak'

继承

class Teacher(Man):
    def __init__(self):
        print 'Teacher init'
    def act(self):
        #使用self调用基类的speak
        self.speak()

 

posted on 2013-11-11 20:18  cfox  阅读(198)  评论(0编辑  收藏  举报

导航