Created
October 29, 2018 07:59
-
-
Save kazagkazag/049c80cda1cbdd1c623d945a068611d6 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 User { | |
fullName(): string; | |
adult(): boolean; | |
} | |
class Citizen implements User { | |
constructor(private firstName: string, private lastName: string, private age: number) { | |
} | |
fullName() { | |
return `${this.firstName} ${this.lastName}`; | |
} | |
adult() { | |
return this.age >= 18; | |
} | |
} | |
const joe = new Citizen("Joe", "Doe", 18) | |
console.log(joe.fullName()) | |
console.log(joe.adult()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment