Liskov Substitution
-
Liskov Substitution Principlepython/SOLID 2023. 12. 6. 22:53
정의 Subclasses should NOT change the behavior of superclasses in unexpected ways. Selecting on types 유형 위반 코드 class Employee: def __init__(self, name): self.name = name class Manager(Employee): def __init__(self, name, department): super().__init__(name) self.department = department def print_employee(e): if type(e) is Employee: print(f"{e.name} is an employee") elif type(e) is Manager: print(f"{..