Board index » delphi » Copy Object and Reference Object?

Copy Object and Reference Object?

How to Copy Object and Reference Object in Delphi?

Thanks
--
Harden ZHU
Harde...@WorldNet.att.net

 

Re:Copy Object and Reference Object?


Quote
>How to Copy Object and Reference Object in Delphi?

If you're talking about "deep copy" versus "shallow (pointer) copy":

A deep copy is done thusly:

  MyObject.Assign(OtherObject);

A pointer copy is done thusly:

  MyObject := OtherObject;

The only caveat on the deep copy is that Assign is defined only for
objects inherited from TPersistent.

  --=- Ritchie Annand

Other Threads