I am new to template programming in C++, so I decided to start with writing a template list. I get this error on line Node<T> *head;
and Node<T> *tail;
Here is my header file (because errors appear only there):
#ifndef LIST_H
#define LIST_H
using namespace std;
template <class T> class List {
public:
List();
T get(const int n);
void add(const T element);
private:
Node<T> *head;
Node<T> *tail;
int size;
};
template <class T> class Node {
public :
Node();
T get();
void setNext(const Node<T> *next);
Node<T> getNext();
void setValue(const T value);
private:
T value;
Node *next;
};
#endif // LIST_H
Oh, and I tried adding typename
before Node<T>
, but it gave me expected nested-name-specifier before 'Node'
.