Use mixins to implement multiple inheritance in ExtJS4. The specific example code is as follows:
Copy the code code 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();
});
})();
What needs to be noted is the difference between mixins and extend. Extend can only implement single inheritance, because the parameter followed by extend can only be a String type string, and files cannot be separated by commas.
Multiple classes can be loaded in mixins to achieve the effect of multiple inheritance.