[fpc-pascal] Cloning objects?

Timothy Groves the.tail.kinker at gmail.com
Wed Mar 19 23:01:28 CET 2014


Is there a drop-dead simple way to clone an object?

I've got a small tree of classes (tBaseProfile, and four descendants of 
such).  Only the descendant classes are instantiated.  I need to be able 
to create new copies of these objects for use in other lists.

At the moment, I am writing a Duplicate method that returns the new 
object.  But this means assigning all of the data to the duplicated 
object.  There must be an easier way!



More information about the fpc-pascal mailing list