I have this code:
var MyClass = new Class({
Implements: [Options,Events],
initialize: function(){
},
doStuff: function() {
console.log('In MyClass');
}
});
var MyBetterClass = new Class({
Extends: MyClass,
initialize: function() {
},
doExtraStuff: function() {
console.log('In MyBetterClass');
}
});
var a = new MyBetterClass();
When doStuff is called somewhere I want the doExtraStuff to get called too. How would I go about doing this? It’s so I do not have to mess around with someone elses code, but when something happens in their code I want something else to happen in mine. There is no event fired in the parent class.
What you should do is override the doStuff method in MyBetterClass, then call the overridden method on the super class: