Hi guys,
Discovered this bit of weirdness and thought it should be documented in case anyone else is having strange issues like this.
class A extends Model and has a variable prop1 and a method
manipulateProp1:function(value){
this.prop1 = value;
}
class B extends class A
instantiate 2 of class B.
var y = new B();
y.manipulateProp1(23);
var z = new B();
z.prop1 == 23 //is true.
Any properties defined in the superclass that are manipulated by the superclass wind up changing the values for all subclass instances. Weirdest part is that if the property is in the superclass but manipulated by the subclass methods then the values aren't shared.
I'm probably missing something simple here but this seems to be what is happening for me.
Thanks
Bob
Discovered this bit of weirdness and thought it should be documented in case anyone else is having strange issues like this.
class A extends Model and has a variable prop1 and a method
manipulateProp1:function(value){
this.prop1 = value;
}
class B extends class A
instantiate 2 of class B.
var y = new B();
y.manipulateProp1(23);
var z = new B();
z.prop1 == 23 //is true.
Any properties defined in the superclass that are manipulated by the superclass wind up changing the values for all subclass instances. Weirdest part is that if the property is in the superclass but manipulated by the subclass methods then the values aren't shared.
I'm probably missing something simple here but this seems to be what is happening for me.
Thanks
Bob
Aucun commentaire:
Enregistrer un commentaire