> >oCommon = createobject("common") && This is declared somewhere in my application > >** class creation >oClass1 = createobject("class_1") >oClass2 = createobject("class_2") >oClass3 = createobject("class_3") >oClass4 = createobject("class_4") > >** I want to Add oCommon to oClass1-6 where if I write something like >oClass1.oCommon.Prop_1 = 10 && Assign a value to a property in oClass1 will affect all the other classes > >? oClass2.oCommon.Prop_1 && <-- Gives 10 >? oClass3.oCommon.Prop_1 && <-- Gives 10 >? oClass4.oCommon.Prop_1 && <-- Gives 10 > >>
oCommon = createobject("common") && This is declared somewhere in my application ** class creation oClass1 = createobject("class_1") oClass1.AddProperty("Common",oCommon) oClass2 = createobject("class_2") oClass2.AddProperty("Common",oCommon) oClass3 = createobject("class_3") oClass3.AddProperty("Common",oCommon) oClass4 = createobject("class_4") oClass4.AddProperty("Common",oCommon) ** I want to Add oCommon to oClass1-6 where if I write something like oClass1.oCommon.Prop_1 = 10 && Assign a value to a property in oClass1 will affect all the other classes ? oClass2.oCommon.Prop_1 && <-- Gives 10 ? oClass3.oCommon.Prop_1 && <-- Gives 10 ? oClass4.oCommon.Prop_1 && <-- Gives 10Because all the child object share the same instance of Common as oCommon. Assign a value to one should appear in all.