The compiler gives me a error C2955: 'Node' : use of class template requires template argument list. Some one wanna look it over and gimme some tips?
//list.h
#ifndef LIST_H
#define LIST_H
#include "node.h"
#include <iostream>
template <typename T>
class List
{
private:
Node * m_head_node;
Node * m_current_node;
Node * m_tail_node;
public:
List()
{
m_head_node = new Node;
m_head_node->prevPtr = NULL;
m_current_node = m_head_node;
m_tail_node = m_head_node;
}
void Add(T const &a)
{
m_tail_node->nextPtr = new Node;
m_tail_node->value = a;
m_tail_node->nextPtr->prevPtr = m_tail_node;
m_tail_node = m_tail_node->nextPtr;
}
void Display()
{
m_current_node = m_head_node;
while (m_current_node->nextPtr != NULL)
std::cout<<m_current_node->value;
}
};
#endif
//node.h
#ifndef NODE_H
#define NODE_H
template <typename T>
class Node
{
public:
Node(){};
Node * prevPtr;
T value;
Node * nextPtr;
};
#endif
//main.cpp
#include "list.h"
int main()
{
List <int> myList;
myList.Add(5);
myList.Add(12);
myList.Add(56);
myList.Display();
system("pause");
return 0;
}