Use mixins to implement multiple inheritance in ExtJS4. The specific example code is as follows:
(function(){
Ext.onReady(function(){
Ext.define('say',{
canSay:function(){
alert("hello");
}
});
Ext.define('eat',{
caneat:function(){
alert("eating");
}
});
Ext.define("user ",{
mixins:{
csay:'say',
ceat:'eat'
}
});
var ss = Ext.create("user", {});
ss.caneat();
ss.canSay();
});
})();
One thing to note is mixins The difference from extend is that extend can only implement single inheritance because the parameter followed by extend can only be a string of type String, and files cannot be separated by commas.
Multiple classes can be loaded in mixins to achieve the effect of multiple inheritance.