To add a protected method to a class in TypeScript, you will need to use the protected
keyword as an access modifier for the method.
index.ts78 chars6 lines
The protected
keyword allows the method to be accessed within the class as well as within any subclasses of the class.
To call the protected method from within the class or subclass, use the this
keyword to reference the instance of the class, like this:
index.ts86 chars6 lines
gistlibby LogSnag