//creating the main Object variables with static Propertys
var MySystem={
Utility:{},
AppDbSystem:{
connecterObj:"",
objCollection:new Array(),
sendObjCollection:null,
phpGridCollection:null
},
OutManager:{},
DbIndex:{},
GoDb:{},
Ioform:{},
ListView:{},
WindowSystem:{},
AngularSystem:{
objCollection:null
}
}
//the parent class (top of the chain)
MySystem.GoDb.GoDb=function(){
var that=this;
this.namespace;
this.speicher;
this.initGoDb=function(table,group,indexArr,readOnly){
that.speicher=table;
}
this.showS=function(){
alert(that.speicher);
}
this.setNamespace=function(ns){
that.namespace=ns;
}
this.getNamespace=function(){
return that.namespace;
}
}
//ListView second Class of the Chain
MySystem.ListView.ListView=function(){
var that=this;
MySystem.GoDb.GoDb.apply(this); //IMPORTANT to make it as an Instance
this.initListView=function(submitIndex,idArr,methodActionArr){
that.initGoDb(submitIndex);
}
}
MySystem.ListView.ListView.prototype=new MySystem.GoDb.GoDb();
//The Child Class
MySystem.ListView.ListStandard=function(){
var that=this;
MySystem.ListView.ListView.apply(this);
this.init=function(elementYArr,attrs,methodActionArr,idArr,tableId,styleArr,styleArrTr,styleArrTd,withNumbers,submitIndex){
that.initListView(elementYArr);
}
}
MySystem.ListView.ListStandard.prototype=new MySystem.ListView.ListView();
//now use it
var test=new MySystem.ListView.ListStandard();
var test2=new MySystem.ListView.ListStandard();
test.init("eazy");
test.showS();
test2.init("second obj");
test2.showS();
test.showS();
看看http://www.zipcon.net/~swhite/docs/computers/languages/object_orientation_JS/inheritance.html
并且不要忘记进行应用调用。
MySystem.ListView.ListView.apply(this);
否则 Object 属性是静态的,不可继承。