-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path10-square.py
More file actions
executable file
·29 lines (25 loc) · 806 Bytes
/
Copy path10-square.py
File metadata and controls
executable file
·29 lines (25 loc) · 806 Bytes
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
#!/usr/bin/python3
"""
Module 10-square
Contains parent class BaseGeometry
with public instance method area and integer_validation
Contains subclass Rectangle
with instantiation of private attributes width and height, validated by parent,
extends parent's area method and prints with __str__
Contains subclass Square
with instantiation of private attribute size, validated by superclass
"""
Rectangle = __import__('9-rectangle').Rectangle
class Square(Rectangle):
"""inherits from Rectangle, who inherits from BaseGeometry
methods:
__init__(self, size)
"""
def __init__(self, size):
"""initializes size
Args:
size (int): private
"""
self.integer_validator("size", size)
super().__init__(size, size)
self.__size = size