from dataclasses import dataclass
@dataclass
class Rectangle:
# Constructor
height: float
width: float
@dataclass
class Square(Rectangle):
# initialization with default value
side: float = 4
# post initialize inheritance constructor
def __post_init__(self):
super().__init__(self.side, self.side)
sq = Square(height=10, width=2)
print(sq)
# output Square(height=4, width=4, side=4)