@property关键字
2019-06-25 本文已影响0人
鲸随浪起
class Cell:
_a = 'a'
@property
def state(self):
return self._a
@state.setter
def state(self,value):
self._a = value
if __name__ == '__main__':
c = Cell()
c.stare = 'b' #设置
print(c.state) #读取