Difficulty creating a templated class

I am attempting to create a templated class that implements a circularly linked list, but I am getting some errors I don't know how to resolve

Here is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef CIRCLE
#define CIRCLE
using namespace std;
template<typename dataType>
class CircularLinkedList{
public:
	CircularLinkedList(){;}
	//CircularLinkedList(const CircularLinkedList<dataType>& other){this = other;}
	//CircularLinkedList operator=(const CircularLinkedList<dataType>& other)
	//deleteNode(const dataType& = refNode);
	class linkedListNode{
			linkedListNode<dataType> *next,*last;
		public:
			dataType data;
			friend class CircularLinkedList<dataType>;
	};
	protected:
		linkedListNode<dataType> *refNode;
};  
#endif // CIRCLE 


the errors that come up are as follows (the text in parenthesis is my comments):
1
2
3
4
error C2059: syntax error: '<' (on line 12 )
error C2238: unexpected token(s) preceding ';' (on line 12)
error C2059: syntax error: '<' (on line 18)
error C2238: unexpected token(s) preceding ';' (on line 18)

Last edited on
class linkedListNode linkedListNode<dataType>
See anything wrong?
The first of the two is declared as a non-templated class.
The second one treats it as a templated class.

You either remove <dataType> on the other lines related to linkedListNode (not CircularLinkedList!), or you add template <typename dataType> before declaration, both will work, but I suggest the first.
Last edited on
Topic archived. No new replies allowed.