Working on a linked list implementation program but I'm getting an error in one of the member functions of my class that I commented out below.
template <class T>
class LinkedList: public ABCList<T> {
private:
struct ListNode{
T Data;
ListNode *next;
};
ListNode *head;
int count;
ListNode* find(int pos);
public:
LinkedList();
bool isEmpty ();
int getLength () ;
void insert (int pos, T item) ;
T remove (int pos) ;
T retrieve (int pos) ;
};
//MEMBER FUNCTION DEFINITION
template<class T>
ListNode* LinkedList<T>::find(int pos) //THIS IS WHERE THE ERROR IS IT SAYS THAT
ListNode E ISN'T A VALID Type
EVEN THOUGH I clearly defined the
funtion with type ListNode
pointer as a private member function.
{
ListNode *n = head;
for (int i=1;i<pos;i++) {
n=n->next;
}
return n;
}