abstract property ts code example
Example: ts abstract class
abstract class Person {
name: string;
constructor(name: string) {
this.name = name;
}
display(): void{
console.log(this.name);
}
abstract find(string): Person;
}
class Employee extends Person {
empCode: number;
constructor(name: string, code: number) {
super(name);
this.empCode = code;
}
find(name:string): Person {
return new Employee(name, 1);
}
}
let emp: Person = new Employee("James", 100);
emp.display();
let emp2: Person = emp.find('Steve');