Discuss / Python / zuoye

zuoye

Topic source
class Screen(object):
    @property
    def width(self):
        return self.__width
    @width.setter
    def width(self,w):
        if isinstance (w,(int,float)):
            self.__width = w

    @property
    def height(self):
        return self.__height
    @height.setter
    def height(self,h):
        if isinstance (h,(int,float)):
            self.__height = h

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

  • 1

Reply