>>An object passed by val........oNewObj = (code to duplicate oObjeRef as a new instance)
>
>Ed, would this then be the equivalent of the function of a copy constructor in C++?
>
Pretty much on the money.
>This got me thinking. would this be sufficient to implement this(is deep copy the right term?) in VFP?
>
I think Dragan published some code a while ago that did the necessary work.
The loop below would need to be aware of the kind of thing being assigned, because objects can contain objects. You also have the issue of things like private data sessions to make life -really- messy.
>
>
>oObj = CREATEOBJECT("someObj")
>* Do stuff with oObj
>oNewObj = oObj.copy()
>
>* someObj::copy
>n = AMEMBERS(la_props,this)
>o = CREATEOBJECT ("someObj")
>FOR x = 1 TO n
> o.&la_props[x] = this.&la_props[x]
>ENDFOR
>RETURN o
>
>* someObj::Error
>LPARAMETERS nError, cMethod, nLine
>IF UPPER(cMethod) = "COPY"
> IF nError = 1743
> RETURN .t.
> ENDIF
>ENDIF
>* Normal error handling goes here
>
>
>Does that look right?