It seems like properties of objects which themselves are other objects should behave the same as the parent object in terms of referencing. What I mean is …
Say an ObjectA has several properties, one of which is another ObjectB, which itself has properties, among them: i as an integer. So we can get i by:
ObjectA.ObjectB.i
Now say I have an array of these ObjectsA()
And say I want to change the values of i for certain members of this array according to certain conditions met by other properties of members of ObjectsA(), the new values requiring array-oriented sorting and calculation.
I can create an array of ObjectsB() by something like the following:
[code]// make an array of ObjectsB from ObjectsA according to someparam
dim ObjectsB() as ClassOfObjectB
for n as integer = 0 to ObjectsA.Ubound
if ObjectsA( n ).someparam > -1 then ObjectB.append ObjectsA( n ).ObjectB
next n
// change the values of i for these ObjectsB() according to some external logic
for n as integer = 0 to ObjectsB.Ubound
if SatisfysConditions( ObjectsB( n ) ) then ObjectsB( n ).i = SomeExternalLogic( ObjectsB( n ) )
next n
[/code]
After I’ve done this, I should be able to go back to the ObjectsA() array, and see that I’ve successfully changed the values of those ObjectB.i properties that were referenced in my ObjectsB() array.
My problem is, I am doing this, yet the values of ObjectsA( n ).ObjectB.i aren’t changing.
The paths the objects take in my actual code are much more convoluted than what I show here, but I’ve looked very carefully at my code to make sure that I never destroy or recreate a reference during the process of assigning a new value. The reference should be maintained throughout, but somehow after setting the value, the object from the original array of ObjectsA hasn’t been changed. Is there something different about the reference life of an object that exists as a property of another object?