Discuss / Python / 一段lowlow的练习

一段lowlow的练习

Topic source

大王aj

#1 Created at ... [Delete] [Delete and Lock User]
@property
def width(self):
    return self.__width
@width.setter
def width(self, width):
    if not isinstance(width, int):
        raise ValueError('width should be a int type number')
    self.__width = width

@property
def height(self):
    return self.__height
@height.setter
def height(self, height):
    if not isinstance(height, int):
        raise ValueError('height  should be a int type number')
    self.__height = height

@property
def resolution(self):
    return self.__width * self.__height

  • 1

Reply