> This indeed only copies the pointer. if you want to do more > than that, then you need to implement this yourself. > > TPersistent implements the 'Assign' method for this. You can > create a descendent from TPersistent, override the Assign > method, and then copy fields as necessary in the new Assign method.
And also that, whilst this sounds tedious, you could (in Delphi mode only I guess) use RTTI to automate some of it. There is at least one component (have a look for zproplst.zip on Torry.net, or if you have the Delphi source there is a hidden TPropList class) that goes through the published members and gets all their names and types. You can then use the routines in the unit Typinfo (might be part of fcl I guess, should be in the Delphi compatible part of the RTL at least though) to retrieve and set their values. Caveat, you *must* declare all members that you with to get at as being Published, it only really works well for properties and your classes should descend from Tpersistent. Having said all that, it works really well in Delphi, and I assume Delphi mode (S2 or Sd). Does the TP or the ObjFPC mode support RTTI and the Typinfo unit? Noting also that whilst C++ has a nice syntax for this (the 'copy' constructor/operator overloading dodge) all it really does is the same as Assign (mostly) but just in a more convoluted way. Matt _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal