Error in @property for getter and setter Python 3.9

196 Views Asked by At

I am learning this abstract topic but long time ago stuck in this excercise, really dont know why not working, thank you people

class Square(ForeignClass):

    def __init__(self, height=0, width=0):
        self._height = height
        self._width = width

    @property
    def get_height(self):
        return self._height

    @get_height.setter
    def set_height(self, height_param):
        self._height = height_param

A_obj = Square(90, 90)
print(A_obj.get_height)
A_obj.set_height(777)
print(A_obj.get_height)

=================================================

output after running

90
Traceback (most recent call last):
  File "C:\Users\Square.py", line 36, in <module>
    A_obj.set_height(777)
TypeError: 'int' object is not callable
0

There are 0 best solutions below