Last active
September 20, 2019 08:23
-
-
Save AliN11/ad36e4a6b89d3438eebbdcb0dfa9ad90 to your computer and use it in GitHub Desktop.
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 LanguageInterface { | |
sayHello(): string; | |
} | |
class Persian implements LanguageInterface { | |
public sayHello(): string { | |
return 'درود'; | |
} | |
} | |
class French implements LanguageInterface { | |
public sayHello(): string { | |
return 'Bonjour'; | |
} | |
} | |
class Hello { | |
public say(lang: LanguageInterface): string { | |
return lang.sayHello(); | |
} | |
} | |
let obj = new Hello; | |
console.log(obj.say(new Persian)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment