Protected and Abstract Classes
Learn about the features of protected and abstract classes in TypeScript.
We'll cover the following
Protected classes
Classes can mark both properties and functions with the protected
keyword. If a property is marked as protected
, then it is not accessible outside of the class itself, similar to the behavior of the private
keyword.
It is, however, accessible to derived classes, which is different from private
variables that are not accessible to derived classes, which can be seen in the following example:
Get hands-on with 1200+ tech skills courses.