class Employee {
eName: string|undefined; // public
protected eID: number;
constructor(name: string, ID: number){
this.eName = name;
this.eID = ID;
}
}
class Programmers extends Employee{
private pLanguage: string;
constructor(name: string, ID: number, language: string) {
super(name, ID);
this.pLanguage = language;
}
display = () => console.log(this.eID + ' ' + this.eName + ' ' + this.pLanguage)
}
let emp = new Programmers("HAL 9000", 8474672, "TypeScript");
emp.display();
// emp.eID; // Property 'eID' is protected and only accessible within class 'Employee' and its subclasses.(2445)
/*
run:
"8474672 HAL 9000 TypeScript"
*/