-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircle.py
38 lines (31 loc) · 929 Bytes
/
Circle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Python CMD program, object-oriented shape class and subclasses, enter the shape's name, color and other attributes
to construct them and calculate the area and perimeter.
using Python version 3.11.4
@version : 1.0
@license: MIT License
@author : Arman Azarnik
contact me at : [email protected]
"""
from Shape import Shape
class Circle(Shape):
"""
Circle class, subclass of Shape class
"""
count = 0
def __init__(self, color = None, r = None):
super().__init__(color)
self.set_radius(r)
Circle.count += 1
def __del__(self):
Circle.count -= 1
def get_shape(self):
return "circle"
def get_color(self):
return super().get_color()
def get_radius(self):
return self.radius
def set_radius(self, r = None):
if r is None or r<0:
self.radius = 1
else:
self.radius = r