Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript class inheritance

class Person {
    constructor(private firstName: string, private lastName: string) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
    getFullName(): string {
        return `${this.firstName} ${this.lastName}`;
    }
    describe(): string {
        return `This is ${this.firstName} ${this.lastName}.`;
    }
}
Code language: TypeScript (typescript)
Source by www.typescripttutorial.net #
 
PREVIOUS NEXT
Tagged: #typescript #class #inheritance
ADD COMMENT
Topic
Name
3+7 =