Skip to content

Instantly share code, notes, and snippets.

@kazagkazag
Created October 29, 2018 07:59
Show Gist options
  • Save kazagkazag/049c80cda1cbdd1c623d945a068611d6 to your computer and use it in GitHub Desktop.
Save kazagkazag/049c80cda1cbdd1c623d945a068611d6 to your computer and use it in GitHub Desktop.
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