Interface Segregation
-
Interface Segregation Principlepython/SOLID 2023. 12. 6. 23:20
정의 No client should be forced to depend on methods it does not use 위반코드 from abc import ABC, abstractmethod class Phone(ABC): @abstractmethod def call(self, number): pass @abstractmethod def swipe_to_unlock(self): pass class IPhone(Phone): def call(self, number): print(f"Calling Number: {number} from iPhone") def swipe_to_unlock(self): print("iPhone is unlocked") Phone interface 는 전화(call) 와 잠금 ..