<aside> 💡 클라이언트가 자신이 이용하지 않는 메서드에 의존하지 않아야 한다는 원칙
</aside>
interface Employee {
fun calculatePay() // CFO만 사용
fun save() // CTO 만 사용
fun reportHours() // COO만 사용
}
class CTO : Employee
class CFO : Employee
class COO : Employee
save 함수만, CFO는 calculatePay 함수만, COO는 reportHours 함수만 필요함interface CTOInterface {
fun save()
}
interface CFOInterface {
fun calculatePay()
}
interface COOInterface {
fun reportHours()
}
interface Employee : CTOInterface, CFOInterface, COOInterface
class CTO : CTOInterface
class CFO : CFOInterface
class COO : COOInterface