I’m in way over my head on this one (learning OO dev techniques) so i’m not sure i’m even describing this right. Anyway, i’m creating an array within a subclass (mySubClass()) and passing the array to the superclass (mySuperClass()) via the call method. It’s not working ? However, if i pass the array *to*then
[code]
/* Define super class */
function mySuperClass(sFoo,iBar,aMyArray){
this.myArray=aMyArray;
this.bar=iBar;
this.foo=sFoo;
if(typeof mySuperClass.initialized==’undefined’){
/* do lots of stuff */
mySuperClass.initialized=true;
}
}
/* Define sub class */
function mySubClass(sFoo,iBar){
this.myArray={
key1:’value1′,
key2:’value2′,
key3:’value3′
};
this.foo=sFoo;
this.bar=iBar;
mySuperClass.call(this,this.foo,this.bar,this.myArray); /* <- seems to break here */
if(typeof mySubClass.initialized==’undefined’){
/* do lots of stuff */
mySubClass.initialized=true;
}
}
/* Test it */
MySubClass.prototype=new MySuperClass();
var testIt=new MySubClass(‘string’,34);
What am i doing wrong? ?