[求助]该怎么写这个方法
#include <iostream>using namespace std;
typedef double Queue_entry;
typedef Queue_entry Node_entry;
enum Error_code { success,underflow,overflow };
struct Node
{
Node_entry entry;
Node *next;
Node();
Node(Node_entry item,Node *add_on = NULL);
};
class Queue
{
public:
Queue();
bool empty() const;
Error_code append(const Queue_entry &item);
Error_code serve();
Error_code retrieve(Queue_entry &item) const;
~Queue();
Queue(const Queue &original);
Queue & operator=(const Queue &original);
protected:
Node *front,*rear;
};
class Extend_queue: public Queue
{
public:
bool full() const;//要判断这个链对是否为满,该怎么判断,告诉我一下方法就可以,谢了
int size() const;
void clear();
Error_code serve_and_retrieve(Queue_entry &item);
};
int Extend_queue::size() const
{
Node *window = front;
int count = 0;
while(window != NULL)
{
window = window->next;
count++;
}
return count;
}