What does the `protected` access modifier allow in TypeScript?

TypeScript Associate Easy

TypeScript Associate — Easy

What does the `protected` access modifier allow in TypeScript?

Key points

  • `protected` allows access within the class and its subclasses
  • Provides a level of encapsulation by restricting access
  • Different from `private` which restricts access to the defining class only

Ready to go further?

Related questions