Other object-oriented languages such as C# and C++ as well as TypeScript, allow static members. Readers fluent in C# should know what static members are, so this section gives just a simple recall, focusing on the peculiarities of TypeScript.
All class members considered so far are called instance members, since they are tied to a specific instance of the class. The meaning of tied is different for properties and methods:
- Properties have different values for each class instance. Thus, for instance, the string one gets with myPerson.name depends on and is specific to the class instance contained in the myPerson variable.
- The method's code is the same for all instances, but methods are tied to a specific instance through the this symbol. In other words, when a method is invoked on a specific class instance, all occurrences of this...