“Наследие класса типовойписа” Ответ

Наследие класса типовойписа

class Employee extends Person {
    constructor(
        firstName: string,
        lastName: string,
        private jobTitle: string) {
        
        // call the constructor of the Person class:
        super(firstName, lastName);
    }
}
Code language: TypeScript (typescript)
Bhela

Наследие класса типовойписа

class Employee extends Person {
    //..
}
Code language: TypeScript (typescript)
Bhela

Наследие класса типовойписа

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)
Bhela

Ответы похожие на “Наследие класса типовойписа”

Вопросы похожие на “Наследие класса типовойписа”

Больше похожих ответов на “Наследие класса типовойписа” по TypeScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования