modifiers and it is by default public.
3. Protected and
Public by default! Stayed Informed – Learn Angular 2 with TypeScript
Public Modifier – Public by default! It is freely access anywhere.
In the below example, the class Employee and its members are by default public and we are freely access it.
Private Modifier -When using private modifier, we can’t be accessed from outside of its containing class.
Protected Modifier - The protected modifier is very similar to private but only one difference that can be accessed by instances of deriving classes.
Readonly Modifier - Read-only properties must be initialized at their declaration or in the constructor.
For example as,
Stayed Informed – Learn Angular 2 with TypeScript