-
Notifications
You must be signed in to change notification settings - Fork 0
/
Square.py
40 lines (31 loc) · 991 Bytes
/
Square.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
39
40
"""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 : armanazarnik@gmail.com
"""
from Rectangle import Rectangle
class Square(Rectangle):
"""
Square class, subclass of Shape class and subclass of Rectangle class.
"""
count = 0
def __init__(self, color, l = None):
super().__init__(color, l, l)
Square.count += 1
def __del__(self):
Square.count -= 1
def get_shape(self):
return "square"
def get_color(self):
return super().get_color()
def get_lenght(self):
return self.lenght
def get_width(self):
return self.width
def set_lenght(self, l = None):
super().set_lenght(l)
def set_width(self, w = None):
super().set_width(w)