I have an extended "class" extending a base "class" using prototypes. The problem I'm having is how do I call methods defined on the prototype of the base class (base methods) from the inheriting classes prototype method.
function Obj() {
this.name;
}
Obj.prototype.baseMethod = function(usefulstuff) {
alert(usefulstuff);
}
function extendedObj() {
Obj.call(this);
}
extendedObj.prototype = new Obj();
extendedObj.prototype.constructor = extendedObj;
extendedObj.prototype.anotherMethod = function() {
this.baseMethod(stuff);//gives this.baseMethod is not a function and direct call gives baseMethod is not defined
}
var a = new extendedObj();
a.anotherMethod();
Surely because the prototypes of both objects are the same and methods have only been added and because the prototype methods are public, this should be fine, unless this isn't how prototype chaining works?