Linked List Problem

I have some problem with my linked list class, which looks like a simple mistake that is easy to correct. The error I am getting for it is:

error C2601: 'SortedLinkedList::Print' : local function definitions are illegal

This is my class declarations:
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
class SortedLinkedList
{
private:
	typedef struct ptrNode //container for a node
	{
		string name; //name of node
		ptrNode* next; //points to next node
	};
	ptrNode* head; //beginning of a list; same thing as listData in book
	ptrNode* tail; //end of a list
	ptrNode* currentPos; //current position in list
	int length;
public:
	SortedLinkedList(); //constructor
	~SortedLinkedList(); //destructor
	bool IsFull() const; //tells if list is full
	bool Empty() const { return head == NULL; } //checks if list is empty; true when head == NULL
	int GetLength() const; //returns length of list
	string GetItem(const string&, double& timeTaken); //returns a string if it exists
	void PutItem(const string&, double& timeTaken); //adds an item to list
	void DeleteItem(const string&, double& timeTaken); //deletes an item from list
	void ResetList(); //empties the list
	string GetNextItem(); //returns the next string in the list
	void Print(); //displays all items in list
	void Generate(const int); //special driver command //generates random strings
};


And the problem I am having with it is somewhere in here, but the IDE shows no squiggly lines pointing out what exactly is the problem:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void SortedLinkedList::Print()
{
	currentPos = head;
	if(currentPos != NULL) { //makes sure there is place to start
		while(currentPos->next != NULL) {
			cout << currentPos->name << " ";
			currentPos = currentPos->next;
		}
		cout << currentPos->name;
	}
	else {
		cout << "There are no values in the list to Print!";
	}
}


Can someone help me figure this out please?
Aw snap! I figured it out... I was missing a single brace in one of the other functions that was causing this weird error. *facepalm*
Topic archived. No new replies allowed.