I have set up a base class as standard:
MyBase = function() {
this.m_Stuff = 0; // etc
};
MyBase.prototype.MySuperFunction = function (arg1) {
alert(
It's similar to the call in your inherited constructor. You can access the "super" method still on MyBase.prototype.MySuperFunction
(where you assigned it), so use:
MyBase.prototype.MySuperFunction.call(this, arg1);
For a more dynamic approach you even might use Object.getPrototypeOf
to get the prototype, but watch out that it works with dynamic inheritance. And if you have many methods that need to call their parent, it can be helpful to alias MyBase.prototype
as a super
variable which is accessible to all functions on the Child prototype object (see this answer for an example)).
Please apply the following:-
MyBase.prototype.MySuperFunction.call(this, arg1);