From c6536762d13773885a3e85f6acd4e238873eb1f2 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hypki Date: Tue, 4 Apr 2023 18:16:26 +0200 Subject: [PATCH] 'Bringing back python classes;' --- python/.project | 17 ----------------- python/Circle.py | 11 ----------- python/Figure.py | 4 ---- python/Rectangle.py | 13 ------------- python/Square.py | 12 ------------ python/main.py | 15 --------------- python/net/hypki/Main.py | 10 ---------- 7 files changed, 82 deletions(-) delete mode 100644 python/.project delete mode 100644 python/Circle.py delete mode 100644 python/Figure.py delete mode 100644 python/Rectangle.py delete mode 100644 python/Square.py delete mode 100644 python/main.py diff --git a/python/.project b/python/.project deleted file mode 100644 index 498050e..0000000 --- a/python/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - wmii-prog-obiektowe-python - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/python/Circle.py b/python/Circle.py deleted file mode 100644 index de3c245..0000000 --- a/python/Circle.py +++ /dev/null @@ -1,11 +0,0 @@ -from Figure import Figure - - -class Circle(Figure): - _r = None - - def setr(self, r): - self._r = r - - def area(self): - print("area = " + str(3.14 * self._r**2)) diff --git a/python/Figure.py b/python/Figure.py deleted file mode 100644 index 009309f..0000000 --- a/python/Figure.py +++ /dev/null @@ -1,4 +0,0 @@ -class Figure: - - def area(self): - print("Not implemented") \ No newline at end of file diff --git a/python/Rectangle.py b/python/Rectangle.py deleted file mode 100644 index 7815e5f..0000000 --- a/python/Rectangle.py +++ /dev/null @@ -1,13 +0,0 @@ -from Figure import Figure -from Square import Square - - -class Rectangle(Square): - - _y = None - - def sety(self, y): - self._y = y - - def area(self): - print("area = " + str(self._x * self._y)) diff --git a/python/Square.py b/python/Square.py deleted file mode 100644 index e4564b3..0000000 --- a/python/Square.py +++ /dev/null @@ -1,12 +0,0 @@ -from Figure import Figure - - -class Square(Figure): - - _x = None - - def setx(self, x): - self._x = x - - def area(self): - print("area = " + str(self._x * self._x)) diff --git a/python/main.py b/python/main.py deleted file mode 100644 index 14698d6..0000000 --- a/python/main.py +++ /dev/null @@ -1,15 +0,0 @@ -from Circle import Circle -from Figure import Figure -from Rectangle import Rectangle - -if __name__ == '__main__': - r = Rectangle() - r.setx(4) - r.sety(8) - r.area() - - c = Circle() - c.setr(1) - c.area() - - print('Finished') diff --git a/python/net/hypki/Main.py b/python/net/hypki/Main.py index dc4b545..ab1c9cb 100644 --- a/python/net/hypki/Main.py +++ b/python/net/hypki/Main.py @@ -20,14 +20,4 @@ if __name__ == '__main__': # print(str(s1.__name)) # will not work print(s1.get_name()) - # generics... actually are not needed - duck typing - figList = [Figure('f1'), Figure('f2')] - print(figList) - print(*figList) # uses our __str__ function - - figList = [Square('s1'), Square('s2')] - print(figList) - print(*figList) # uses our __str__ function - print(figList[0].get_name()) # but there is no help from IDE - print('Finished!') \ No newline at end of file