var Person = Ext.emptyFn;
Ext.apply(Person.prototype,{
id:0,
name:"",
print:function(){
alert(String.format("id={0},name={1}",this.id,this.name));
}
});
/************************** 继承。******************/
var Student = function(cfg) {
Ext.apply(this,cfg);
}
// 类Student继承Person,并增加了一个字段address
Ext.extend(Student,Person,{
address:""
});
var student = new Student();
student.id = 2000;
student.name = "extends";
student.address = "深圳市";
student.print();
alert(student.address);
student = new Student({id:3000,name:"china",address:"hub"});
student.print();
Ext类继承
最新推荐文章于 2018-06-14 15:27:32 发布