Place this function in your list and check it out.
Code:
void Link::AddNode(Node *W){
//Create a new node to add it to list each time function called.
//Don't add W directly to list as it is created outside
//of list and therefore may be changed by factors
//outside of list which may screw up your list
Node * newNode = new Node;
//copy name from W to name in newNode
newNode->name = W->name;
//make newNode->next equal to NULL
newNode = NULL;
//place newNode, not W, into list in front of start
newNode->next = start;
//move start one node to the left to keep track of
//first node in list.
start = newNode;
}
here's an updated version of a display function to confirm the above code works.
Code:
void Link::displayList()
{
Node* current = start;
while(current != NULL)
{
cout << current->name << endl;
current = current->next;
}
}