python----特性002

python特性002:特性是可继承的

#!/usr/local/python3.5/bin/python3

class Person(object):
    def __init__(self,name):
        self.name=name
    def get_name(self):
        print('this is get name')
        return self.name
    def set_name(self,name):
        print('this is set name')
        self.name=name
    def del_name(self):
        print('this is del name')
        del self.name
    Name = property(get_name,set_name,del_name,'name property ...')

class Manager(Person):
    pass


if __name__=="__main__":
    jlx=Manager('Jianglexing')
    print(jlx.Name)

 

posted on 2016-08-07 14:25  蒋乐兴的技术随笔  阅读(140)  评论(0编辑  收藏  举报

导航