Confusion with deep copy in linked list

Solved by helios, thanks!
Last edited on
I'm guessing List<ItemType>::data is of type 'ItemType *'. Line 9 is attempting to dereference an uninitialized pointer. The correct way would be
curr->data = new ItemType(*aPtr->data);
Thank you for the response! I am surprised I did not notice it sooner. Everything works as it should now.
Please don't edit your post to remove the question. Half of the point of a Q&A forum is that people can search for similar problems and how other people have solved them.
Topic archived. No new replies allowed.