Created
March 25, 2020 09:50
-
-
Save hw0k/8845b84bcfe4b81234d97ab30e46cdde to your computer and use it in GitHub Desktop.
LID 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Animal { | |
eat(): void; | |
sleep(): void; | |
cry(): void; | |
} | |
interface Flyable { | |
fly(): void; | |
} | |
class Bird implements Animal, Flyable { | |
eat(): void { | |
console.log('새가 음식을 먹었어요!'); | |
} | |
sleep(): void { | |
console.log('Zzzzzz....'); | |
} | |
cry(): void { | |
console.log('짹짹!!'); | |
} | |
fly(): void { | |
console.log('새가 하늘을 날았어요!'); | |
} | |
} | |
class Human implements Animal { | |
eat(): void { | |
console.log('아 배부르다'); | |
} | |
sleep(): void { | |
console.log('Zzzzzz....'); | |
} | |
cry(): void { | |
console.log('ㅠㅠㅠ'); | |
} | |
// 마찬가지로 fly() 메서드를 구현하지 않는다. ISP 준수! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment