I have a situation where I have a base class with a protected method called foo, and a child class that needs to make this method publicly accessible. Since this method will be called frequently, I am looking for a more efficient solution to avoid unnecessary function calls. Currently, I have implemented the following workaround:
abstract class A {
protected foo(X:T) {...}
}
class B extends A {
foo(X:T) {super.foo(X);}
}
B.prototype.foo = (<any>A.prototype).foo;
I cannot simply make foo public in class A, as I want all other subclasses of A to only access foo internally. It is only the special child class B that should allow external access to the foo method.