Discuss / Python / 学生交作业

学生交作业

Topic source
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

    @width.setter
    def height(self, value):
        self._height = value

    @property
    def resolution(self):
        return self._width*self._height


screen =Screen()
screen.width=100
screen.height =90
print(screen.resolution)

  • 1

Reply