Posted by Henry on December 02, 2001 at 17:00:11:
In Reply to: Re: Polymorphic deep copy? posted by William D McQuain on December 02, 2001 at 15:01:42:
: : How do you handle a deep copy of the list of trucks?
: Why is this an issue? You shouldn't be making a copy of that anyway. I can (barely) see a scenario where I'd pass it by const reference, but I can't see copying it under any circumstances.
The Object-Oriented Coding Requirements on this page say that we need to make deep copy constructors for any class that has dynamic memory. Doesn't the list of pointers in the Dispatcher class count for that?
: : The way you do a deep copy is to copy member fields individually, and this is certainly possible, but the specific type of truck will certainly be lost in the process. Currently, I've just commented the code to that effect but is there a better way?
Post a Followup