Created
March 25, 2020 09:43
-
-
Save hw0k/1ca0cdff6124af5e021647dd8117118e to your computer and use it in GitHub Desktop.
LID 3
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 FlyableAnimal extends Animal { | |
fly(): void; | |
} | |
class Bird implements FlyableAnimal { | |
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