I have two subclasses that inherit from a parent class.
Class1 inherits from BaseClass
Class2 inherits from BaseClass
I create instances of both classes.
When I display the array content of Class2, I see the contents of Class1 as well.
Ext.onReady(function () {
var c1 = Ext.create('Child1Class');
var c2 = Ext.create('Child2Class');
alert(c2.someArray.join());
//actual result: "BaseClass text ,Class1 text,Class2 text"
//expected :"BaseClass text ,Class2 text"
});
Ext.define('BaseClass', {
someArray: ["BaseClass text "],
});
Ext.define('Child1Class', {
extend : 'BaseClass',
constructor : function(){
this.someArray[this.someArray.length] = "Class1 text";
}
});
Ext.define('Child2Class', {
extend : 'BaseClass',
constructor : function(){
this.someArray[this.someArray.length] = "Class2 text";
}
});
Why is Class1's data also included in the output?