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.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn