class Screen(object):
@property def width(self): return self._width @width.setter def width(self, width): if not isinstance(width, (int, float)): raise ValueError("width应该为数值!") self._width = width @property def height(self): return self._height @height.setter def height(self, height): if not isinstance(height, (int, float)): raise ValueError("height应该为数值!") self._height = height @property def resolution(self): return self._width * self._height
Sign in to make a reply
I-cpp
class Screen(object):