Hi, I have a custom class with lots of variables (some simple, others are instances of other classes) and a few graphic objects. I'm writing a wizard to set the class up and was now wondering how to implement the use of the same wizard to modify and existing item of that class. The main problem would be the implementation of a cancel option.
This yields two paths: if I work on the actual instance of the class, I'd have to keep track of changes so that I can go back to the original in case of cancel. The second (and imo easier) option is to create a new one, copy all the contents of the original, work on that one pseudo applying changes in a virtual way and re-copy the new one to the original in case of "apply" or just dispose it in case of "cancel" and refresh with the original untouched data.
I'm not interested in duplicating the graphic objects, but I do have members that should be deep-copied. That is, the class members of the mother class will have to be instantiated or something.
Is there an easy way of cloning custom classes or will I have to write my own method?
And perhaps wishing for an obvious solution I'm not considering, does anyone now a good way to implement "cancelling" changes to something?