[fpc-pascal] Generic a "Clone" method

Torsten Bonde Christiansen tc at epidata.dk
Tue Jun 16 14:04:11 CEST 2009


I was wondering if it is posible to make this type of construct for 
creating a generic Clone method:

(I put it in pastebin):  http://pastebin.com/fb495ed7

Explained in words - I'm trying to make a clone method that should be 
able to copy the content of private variables to a destination object.
Naturally this destination would have to be of the same class as the 
original, but is it posible to determine the size of used space in each 
derived class, simply by using Sizeof(...). Or do I need to create a 
seperate clone method for each individual derived class.

If it is posible, what memory copy function should I use?

Kind regards,
Torsten Bonde Christiansen.

More information about the fpc-pascal mailing list