What is the bug in the following source code?
I am unable to find it myself.
ShapeBase.py
from abc import ABC
class ShapeBase(ABC):
def __init__(self, idd: str):
self.id_: str = idd
self.cx_: float = 0.0
self.cy_: float = 0.0
@property
def cx_(self) -> float:
return self.cx_
@cx_.setter
def cx_(self, cx: float):
self.cx_ = cx
@property
def cy_(self) -> float:
return self.cy_
@cy_.setter
def cy_(self, cy: float):
self.cy_ = cy
def id(self) -> str:
return self.id_
def area(self) -> float:
pass
Square.py
from shapes.ShapeBase import ShapeBase
class Square(ShapeBase):
def __init__(self, idd: str, a: float):
super().__init__(idd)
self.a_ = a
def area(self) -> float:
return self.a_ * self.a_
def width(self) -> float:
return self.a_
main.py
from shapes.Square import Square
if __name__ == '__main__':
s1 = Square('S1', 4.0)
print("Area = " + str(s1.area()))
Output
C:\Users\pc\AppData\Local\Microsoft\WindowsApps\python3.7.exe C:/Users/pc/source/repos/Shapes/main.py
Process finished with exit code -1073741571 (0xC00000FD)
By the way, this problem is not about the name of the attributes.
This problem is related to inheritance.