But, it seems to be messing up when I'm trying to add a linked list to a node.
Node *ptr=start; //make ptr point to the beginning of the linked list to help transverse the list
if (ptr==NULL)
cout<<"uh-oh";
while (ptr != NULL) //while it's not the end of the list
{
cout<<"helloooooo";
The cout's are to see where the problem is. It prints the "uh-oh" - which is very bad. And it's not printing the "hellooo" (well, obviously, but I tried the hello first and didn't think of the possibility of it being NULL until awhile later).
So, I'm trying to figure out why start would be NULL, and that's what I'm wanting to ask. See, I have the addNode function in the parent linked list, and I thought the parent would take care of that for this linked list. It does, so the start pointer should be at the end of the list. But, since I have a different constructor for this linked list, that sets start to NULL until more nodes are added, does that mean that I have to copy and past the addNode function to get the start pointer moving? (If I'm going to have all the same functions of the parent linked list, does that mean I shouldn't even have it inherit from it?)
This post has been edited by asj127: 01 December 2009 - 06:17 PM

New Topic/Question
Reply



MultiQuote





|