$namespace.using("joopl.enjoyment", function(enjoyment) {
enjoyment.declareClass("A", {
members: {
goEnjoy: function() {
return "this rocks!";
}
}
});
enjoyment.declareClass("B", {
inherits: enjoyment.A,
members: {
enjoyMore: function() {
// goEnjoy() is available because it has been
// inherited!
return this.goEnjoy() + " yeah!";
}
}
});
var b = new enjoyment.B();
// enjoyMore() call will return "this rocks! yeah!"
var text = b.enjoyMore();
document.getElementById("result").appendChild(
document.createTextNode(text)
);
});
<span id="result"></span>
External resources loaded into this fiddle: