class Person {
pName: string;
constructor(name: string) {
this.pName = name;
}
}
class Employee extends Person {
eID: number;
constructor(ID: number, name:string) {
super(name);
this.eID = ID;
}
display = () => console.log(this.eID + ' ' + this.pName)
getSalary() : number {
return 18950;
}
}
let emp = new Employee(837369, 'Professor Albus Dumbledore');
emp.display();
console.log(emp.getSalary());
/*
run:
"837369 Professor Albus Dumbledore"
18950
*/