hello, i am almost done with this program of mine. It is a linked list program, and I have one error left, and it has to do with my friend function. It is used to output stuff in the linked list, but i do not know how to code it right, so i thought maybe someone can help me here. i have provided a link to my program on the internet, and also here is the error i was getting. Thanx a lot!
C:\ELinkedList\ELinkedList2\LinkedListFileee.cpp(1 4) : error C2039: 'item' : is not a member of 'List'
The error message tells you exactly what the error is. If 'item' is not a member of 'List', what is it a member of? ListNode.
I haven't checked it, but your friend function will probably have to do something like -
output << l.head->item;
However, as head is supposed to point to the head, you'll be stuck. Perhaps you need to implement something like an iterator; unless you want you operator << to output the entire list, in which case you'll have to internally iterate through it within the function.