首先看源码:
- Ext.override
= function(origclass, overrides){ -
if(overrides){ -
var p = origclass.prototype; -
Ext.apply(p, overrides); -
if(Ext.isIE && overrides.toString != origclass.toString){ -
p.toString = overrides.toString; -
} -
} - };
-
- Ext.apply
= function(o, c, defaults){ -
if(defaults){ -
Ext.apply(o, defaults); -
} -
if(o && c && typeof c == 'object'){ -
for(var p in c){ -
o[p] = c[p]; -
} -
} -
return o; - };
根据源码我们可以看到override是把对象overrides的方法和属性复制到对象origclass的prototype对象里,在某个程度上这两方法的功能是一样的 。
参考地址:http://www.iteye.com/topic/770292#1684417