|
-
September 25th, 2010, 04:53 PM
#10
Re: Queue Copy Constructor - segfault?
 Originally Posted by mayabelle
Yes, that was the goal. In what way is it not making copies (other than the segfault)?
I stated how your original code may not work. You test original.first_ for NULL, and then you assumed that you must set your object's last_ to NULL along with size being 0. Then you return from the constructor.
What if original.first_ was NULL, but original.last_ wasn't NULL, or original.size_ was not 0? What would happen? Your code would have erroneously created an object that isn't a copy of the original.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|