Discuss / Python / 变量要加‘_’才行

变量要加‘_’才行

Topic source

月半意

#1 Created at ... [Delete] [Delete and Lock User]
class Screen(object):
    @property
    def width(self):
        return self._width
    @width.setter
    def width(self,value):
        self._width = value
    @property
    def height(self):
        return self._height
    @height.setter
    def height(self,value):
        self._height = value
    @property
    def resolution(self):
        return self._height * self._width

  • 1

Reply