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)
上一篇:TYVJ P1023 奶牛的锻炼 Label:dp


下一篇:《Android深度探索》(卷1)HAL与驱动开发读后感: