ByRef and new window constructor

I have a property that is an instance of a large class. So when it around, I do it by ByRef so I am just using a pointer and not passing the whole thing around.

now when I open a new window (something that will edit a subpart of the property), I use ByRef propertyName as type largeClass in the constructor of the window. But How do I use propertyName property within that window? I want to make changes to it, that actually changes the original instance of it in the main window.

Is this clear a mud?

Doesn’t object instances always get passed by reference?

Actually you’re passing a pointer to a pointer when you pass an object byref
Not necessary

I could never remember what does/doesnt.

[quote=133799:@Norman Palardy]Actually you’re passing a pointer to a pointer when you pass an object byref
Not necessary[/quote]

good to know. I think I have more questions… let me go play some and will get back to you.

These are two similar but subtly different uses of the word “reference”.

Objects and arrays are “reference types”, which means that an object- or array-typed value is a reference (aka pointer) to some object property data or to some array element data. The identity of an object is equivalent to the address of its data.

When we talk about method calls, parameters may be passed “ByVal” or “ByRef”. This is an attribute of the parameter, not related to the parameter’s type. “Reference” in this context does not describe object or array data, but a pointer to the variable itself. When you pass a parameter ByRef, what you are doing is giving the called method a pointer to the variable, so that the method can not only read the value it contains but also write a new value back out to it.

You would not be far wrong to interpret “reference” as equivalent to “pointer”. Just don’t confuse the Xojo concept “ByRef” with the concept of a “reference type”, because they are unrelated applications of the same basic idea.