>So you can add/modify properties of a passed by value object but you can't modify the object itself. But if you do pass it by reference (@) then you can actually change the object.
>
If you pass by value, the object is passed, but reassigning the object reference in the called function/method does not affect the original calling object reference. You can modify to your heart's content; if you reassign the pass-by-value object ref, the original object ref from the calling code remains intact.
If you pass by ref, and reassign the object ref in the called code, the modified reference is passed back, so the effects can be devastating. If for example:
oOriginal = CREATEOBJ('someclass')
=ResetParmToNull(oOriginal)
? ISNULL(oOriginal) && .F.
oOriginal=ResetParmToNull(oOriginal)
? ISNULL(oOriginal) && .T.
oOriginal = CREATEOBJ('someclass')
=ResetParmToNull(@oOriginal)
? ISNULL(oOriginal) && .T.
FUNCTION ResetParmToNull
LPARAMETER tuValue
tuValue=NULL
RETURN tuValue
DEFINE CLASS SomeClass AS Custom
ENDDEFINE
>Object variables have their own set of rules is what everyone is telling me. Since I only pass object variables by value and I know this behavior (if not explicitly then intuitively), I can live with it.