关于作者

Discuss / Python / 交作业了

交作业了

问题来源

FJ-W97

#1 Created at ...
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._width * self._height

a = Screen()
a.width = 2
a.height = 3
print(a.width, a.height, a.resolution)

  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.