October 2017
Intermediate to advanced
280 pages
6h 50m
English
Similarly, for most conventional object-oriented languages that support classes, TypeScript allows a definition of access modifiers. In order to deny direct access to the _name property outside the class it is defined in, we can declare it as private:
class Human {
static totalPeople = 0;
private _name: string;
// ...
}
The supported access modifiers by TypeScript are as follows:
Read now
Unlock full access