0

キューを実装するテンプレート クラスを作成する必要があります。これはヘッダー ファイルです。次の行でエラーが発生します。

Node * front;

エラーは次のとおりです。クラス テンプレートの使用にはテンプレート引数リストが必要です。

#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);                                          
};
4

0 に答える 0