0

I have to write template class that implements queue, this is the header file, I get error on this line :

Node * front;

the error is :use of class template requires template argument list,

#include <iostream>
#pragma once
using namespace std;
typedef int Error_code;
#define SUCCESS 0
#define OVERFLOW -1
#define UNDERFLOW -2

template <class T>
class Node{
T item;
Node * next;
Node(){item=0; next=NULL;}
Node(T n){item=n; next=NULL:}
};

template <class T>
class queue
{
protected:

    Node * front;                                               // pointer to front of Queue
    Node * rear;                                                // pointer to rear of Queue
    int count;                                                                                              

public:
    queue();                                        // create queue 
    ~queue();
    bool isempty();
    bool isfull();
    Error_code serve() ;
    Error_code retrieve(T &item);                                   
    Error_code append(T item);                                          
};
templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
Ruaa Brkat
  • 151
  • 1
  • 2
  • 14
  • 1
    Node is a template class, so you need to specify what type it is when you use it: `Node *front` – o_weisman Oct 26 '13 at 13:37
  • @o_weisman I edited the code, would you please check my new question here http://stackoverflow.com/questions/19607352/cannot-access-private-member-declared-in-class-queue-class-template – Ruaa Brkat Oct 26 '13 at 13:40

0 Answers0