From: Adam Hartshorne on
Hi,

I will try and explain my question in the form of an example.

I have a handle based class (lets say the instance is called A) that is basically storing various data and has associated methods. Over time, the data is accessed and updated etc.

Then a particular points in the process I want to basically take a snap shot of the object and store it. I want a copy of the data stored in A at the moment in time, but I will also likely to want to use the methods on the data. Hence why I want to copy the whole object and not just the stored data.

Now obviously if I just do

B = A ;

B just points to the data in A, and any time in the future the data updated (which it will be), B will be pointing to this rather than the "snap shot".

So basically what I want to do is make an identical copy of A such that it is all stored by value (data at that moment in time) in B. What is the easiest / best way of doing this?

Any help much appreciated.