Please Help

I need help on my circular linked list using templates, but I get a number of errors when I compile. Please help..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#ifndef CIRCULARLINKEDLIST_H
#define CIRCULARLINKEDLIST_H
#include <iostream>
#include <string>
using namespace std;

template <class ItemType>
struct nodeType;

template <class ItemType>
class CircularLinkedList
{
	private:
		nodeType <ItemType> *listData;
		int length;
		nodeType <ItemType> *currentPos;

	public:
		CircularLinkedList()
		{
			length = 0;
			listData = NULL;
		}

		~CircularLinkedList()
		{
			makeEmpty();
		}

		CircularLinkedList(const CircularLinkedList<ItemType> &);
		bool operator = (CircularLinkedList<ItemType>);
		bool operator == (CircularLinkedList<ItemType>);
		void operator < (CircularLinkedList<ItemType>);
		void operator > (CircularLinkedList<ItemType>);
		bool isFull() const;
		int getLength() const;
		void retrieveItem(ItemType& item, bool& found);
		void insertItem(ItemType item);
		void deleteItem(ItemType item);
		void resetList();
		void printList();
		void makeEmpty();
		void getNextItem(ItemType &item);
};
#endif

template <class ItemType>
void CircularLinkedList<ItemType>::makeEmpty()
{
	nodeType<ItemType>* tempPtr;

	while (listData != NULL)
	{
		tempPtr = listData;
		listData = listData->next;
		delete tempPtr;
	}
	length = 0;
}

template <class ItemType>
void CircularLinkedList<ItemType>::retrieveItem(ItemType& item, bool& found)
{
	nodeType<ItemType>* location;

	location = listData;
	found = false;

	while( (location != NULL && !found))
	{
		if(item == location->info)
		{
			found = true;
			item = location->info;
		}
		else
			location = location->next;
	}
}

template <class ItemType>
void CircularLinkedList<ItemType>::insertItem(ItemType newItem)
{
	nodeType<ItemType>* location;

	location = new nodeType<ItemType>;
	location->info = newItem;
	location->next = listData;
	listData = location;
	delete location;
	length++;
}

template <class ItemType>
void CircularLinkedList<ItemType>::deleteItem(ItemType item)
{
	nodeType<ItemType>* location = listData;
	nodeType<ItemType>* tempLocation;

	if(item == listData->info)
	{
		tempLocation = location;
		listData = listData->next;
	}
	else
	{
		while(!(item == (location->next)->info))
			location = location->next;

		tempLocation = location->next;
		location->next = (location->next)->next;
	}

	delete tempLocation;
	length--;
}

template <class ItemType>
bool CircularLinkedList<ItemType>::isFull() const
{
	nodeType<ItemType>* ptr;

	ptr = new nodeType<ItemType>;
	if(ptr == NULL)
		return true;
	else
	{
		delete ptr;
		return false;
	}
}

template <class ItemType>
int CircularLinkedList<ItemType>::getLength() const
{
	return length;
}

template <class ItemType>
void CircularLinkedList<ItemType>::resetList()
{
	currentPos = listData;
}

template <class ItemType>
void CircularLinkedList<ItemType>::getNextItem(ItemType &item)
{
	item = currentPos->info;
	currentPos = currentPos->next;
}

template <class ItemType>
void CircularLinkedList<ItemType>::printList()
{
	nodeType* current = head;

	while(current->link != head)
	{
		cout << current->info << " ";
		current = current->link;
	}
	cout << current->info << endl;
}
> I get a number of errors when I compile
It may be a good idea to post the error messages
I got it working after 3 hours of pounding away at it.
Topic archived. No new replies allowed.