Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: copying values between objects.

  1. #11

    copying values between objects.

    Quote Originally Posted by Setharian
    and it is a lot slower than just declaring the copy function by yourself + it does handle deep copying classes only partially - from RTTI you can get class type info and out of that class reference, but that's all, you do not know how to clone the nested classes (that is using standard .Create constructor you can create it, but not assign any data do it)....
    Thats not true. Few days ago I wrote simple recursive procedure which allows me to copy entire object which can consist as many subobjects as I want. RTTI is great feature, of course you need to have a subobject exported to a property but that is not a big problem, isn't it?

    And that elegance...I just love it

  2. #12

    copying values between objects.

    how do you copy the subobject if it has no RTTI? like TList/TObjectList and the like....

  3. #13

    copying values between objects.

    Quote Originally Posted by Setharian
    how do you copy the subobject if it has no RTTI? like TList/TObjectList and the like....
    Ok you can't but at least you can copy its items;-)

  4. #14

    copying values between objects.

    Just an idea. You could use a Hash Table to store your properties associated to strings, then the objects could easily exchange them. If performance is important, you could use this hash-table object as a transmitter, making one object to export all it's properties to the transmitter, and then the other object to import the properties from it.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •