0
Python的财产我有一个Python属性是这样的:公共getter和setter方法私人
class Foo:
@property
def maxInputs(self):
return self._persistentMaxInputs.value
@maxInputs.setter
def maxInputs(self, value):
self._persistentMaxInputs.value = value
目前,maxInputs
值可以得到受到大家的设定。
但是,我想让每个人都可以获得maxInputs
的值,但只能在Foo
类中设置。
那么有没有办法用private private setter和public getter声明一个属性?