We are working on linked lists in our Data Structures class, and our instructor gave us this code to try in our compiler and it's not working for some reason! I commented below where the error is.
ERROR MESSAGE: 'link': is not a member of 'node<T>' CODE C2039
As you can see, it contains a single member variable, named info. It does not contain a member variable named link, so when you try to use the member variable named link, you're trying to use something that doesn't exist. In C++, you can't use member variables that don't exist.
What do you think will happen with the line head->info = item;
if you rewrite the node object like that?
Perhaps you've completely missed the whole point of a linked list. Each element in a linked list is meant to contain some piece of data, and a pointer to the next element in the list.