I'm sure this can be done in less lines and in a more clean way?
function BaseClass() {
BaseClass.prototype.talk = function () {
alert("I'm BaseClass");
}
}
function MyClass() {
BaseClass.call(this);
}
MyClass.prototype = new BaseClass();
MyClass.base = {};
MyClass.base.talk = MyClass.prototype.talk;
MyClass.prototype.talk = function () {
alert("I'm MyClass");
MyClass.base.talk();
}
var a = new MyClass();
a.talk();
BaseClass.prototype.talk
inside the constructor? – Joseph Silber Jan 13 '13 at 6:51