abstract class Person {
pName: string;
constructor(name: string) {
this.pName = name;
}
display(): void {
console.log('display(): void { - ' + this.pName);
}
abstract test(string: string): void;
}
class Employee extends Person {
eID: number;
constructor(name: string, ID: number) {
super(name);
this.eID = ID;
}
test(name: string): void {
console.log('test(name: string): void { - ' + name)
}
}
let emp: Person = new Employee('Professor Albus Dumbledore', 83736);
emp.display();
emp.test('R2D2');
/*
run:
"display(): void { - Professor Albus Dumbledore"
"test(name: string): void { - R2D2"
*/