February 2019
Beginner
694 pages
18h 4m
English
Now for the three types of specialist classes, all derived from the Person base class:
class Infant extends Person {
constructor(dateOfBirth: Date) {
super(dateOfBirth);
this.Category = PersonCategory.Infant;
}
canSignContracts(): boolean { return false; }
}
class Child extends Person {
constructor(dateOfBirth: Date) {
super(dateOfBirth);
this.Category = PersonCategory.Child;
}
canSignContracts(): boolean { return false; }
}
class Adult extends Person {
constructor(dateOfBirth: Date) {
super(dateOfBirth);
this.Category = PersonCategory.Adult;
}
canSignContracts(): boolean { return true; }
}
Each of these classes uses inheritance to extend the Person class. As the DateOfBirth property has been declared as private, and is ...
Read now
Unlock full access