Ext学习之1_类的继承2
Ext.namespace("com.deng");
//Ext的继承更加优雅
com.deng.Second = function(){
//??? com.deng.Second.superclass.constructor.apply(this);//调用父类构造方法
}
//用Ext.extend()实现继承: com.deng.Second 继承 com.deng.First
Ext.extend(com.deng.Second, com.deng.First,{
??? //为子类添加新的方法
??? fun: function(i){
??? ??? return i * i * i;
??? },
??? //重写方法
??? method: function(){
??? ??? alert("overrid First method");
??? }
});
Ext.onReady(function(){
??? //测试
??? var second = new com.deng.Second();
??? alert(second.fun(5));
??? second.method();
??? //不能调用的到first的init方法,只能调用到prototype定义的方法
});