inherit.js is an inheritance javascript library, which supports base method calls an easy way along the inheritance path.
var YourClass = inherit.Base.inherit({
ctor: function(foo, bar) {
// constructor
this.foo = foo;
this.bar = bar;
},
publicFunction: function() {
// function declaration
}
});
var DerivedClass = YourClass.inherit({
ctor: function(foo, bar) {
// call base ctor
this.base.ctor.call(this, foo, bar);
},
anotherPublicFunction: function(){
// your code goes here
},
// overwrite method
publicFunction: function() {
// call base method
this.base.publicFunction.callBase(this);
// do other stuff
}
});
var foo = new YourClass("foo", "bar");
var bar = new DerivedClass("bar", "foo");