Error with Template

I keep getting error C3857: 'ListNode::data': multiple template parameter lists are not allowed in VS2012. I am not quite sure what I am doing wrong. Can anyone help me understand what is happening?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  #pragma once
class ListNode
{
public:
	ListNode* nextPtr;
	template<typename TYPE>
	TYPE& data;
	

public:
	template <typename TYPE>
	ListNode(const TYPE& d, ListNode* n = 0)
	{
		this->data = d;
		this->nextPtr = n;
	}
	ListNode();
};
1
2
3
4
5
6
7
8
9
10
11
12
#pragma one
template <typename TYPE>
class ListNode{
public:
   ListNode* nextPtr;
   TYPE& data; //¿a reference?
   ListNode(const TYPE& d, ListNode* n = 0)
   {
      this->data = d; //this doesn't make sense
      this->nextPtr = n;
   }
};
Last edited on
Its a reference to a class called Movie which holds a title and a rating. I'm using TYPE to be generic.
Topic archived. No new replies allowed.