TelenkovDmitry 6 months ago
parent
commit
804f7560ab
1 changed files with 31 additions and 0 deletions
  1. 31 0
      courses/python_oop/descriptor/desc_1.py

+ 31 - 0
courses/python_oop/descriptor/desc_1.py

@@ -0,0 +1,31 @@
+
+class Point:
+    def __init__(self, x, y):
+        self.x = x
+        self.y = y
+
+    @property
+    def x(self):
+        return self._x
+
+    @x.setter
+    def x(self, value):
+        self._x = int(value)
+
+    @property
+    def y(self):
+        return self._y
+
+    @y.setter
+    def y(self, value):
+        self._y = int(value)
+
+
+def main():
+    point = Point(2, 5)
+    print(point.x)
+    print(point.y)
+
+
+if __name__ == '__main__':
+    main()