[fpc-pascal] Cloning objects?
silvioprog
silvioprog at gmail.com
Wed Mar 19 23:16:27 CET 2014
2014-03-19 19:01 GMT-03:00 Timothy Groves <the.tail.kinker at gmail.com>:
> 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!
I'm working on something right now (using RTTI). I need to clone any
object, even third party objects. I use an OPF and a HTTP framework and
both work directly with objects, and now came the need to clone objects (
http://goo.gl/VVTFcu).
I'll post the code here soon ...
--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140319/7c6d4cdb/attachment.html>
More information about the fpc-pascal
mailing list