interface IPerson {
iName: string;
display():void;
//getSalary(): void;
}
class Employee implements IPerson {
eID: number;
iName: string;
constructor(ID: number, name: string) {
this.eID = ID;
this.iName = name;
}
display = () => console.log(this.eID + ' ' + this.iName)
getSalary() : number {
return 19250;
}
}
let per:IPerson = new Employee(857421, 'Professor Albus Dumbledore');
per.display();
// console.log(per.getSalary()); // Property 'getSalary' does not exist on type 'IPerson'.(2339)
/*
run:
"857421 Professor Albus Dumbledore"
*/