I searched around and seems in order to perform this I need to change my Base class and want to know if this is the best approach. For example, I have a Base class:
I think that templates are the best way to go in this situation:
template class DeepCopy { Base *base; DeepCopy(Sub *sub) { base = new Sub(*sub); // use copy constructor } }
This does mean that DeepCopy's are un-assignable to each other, but that's the price you pay with C++.
DeepCopy