>When would you pass an object by reference, like
>uResult = Bar(@oFoo)
>and why?
>
If the method/function might need to actually destroy the referenced object directly, or might substitute a different object; it causes the original object reference to be altered within the called procedure. For example, oFoo could be an array of object refs (which I'd probably have named aoFoo, but that's a different issue) where I wanted the array of references to be altered by the called code. Or in an object factory, I might create a variable in the caller that had nothing in it to receive an object created by the called code, while still being able to return a result through the function code, eg:
oFoo = NULL
IF ObjectFactory.CreateMeAFoo(@oFoo,bar,mumble,bletch)
ELSE
ENDIF
YMMV. You may not have a use for this. I do. You may never be involved with the issue of a copy of an object vs a copy of an object reference. I am.