问一个弱弱的问题
有关类定义的时候的一个问题:
------------------------- 头文件queue.h ---------------
const int ARRAY_SIZE = 10;
class Queue{
private:
int elem[ARRAY_SIZE];
int first;
int length;
public:
void Init();
void EnQueue(int newElem);
int DelQueue();
int GetLength(){return length;}
void Print() const ;
};
------------ 函数定义queue.cpp ---------
#include <iostream.h>
#include "queue.h"
void Queue::Init()
{
first = length =0;
}
void Queue::EnQueue(int NewElem)
{
int pos =(first + length)%ARRAY_SIZE ;
elem[pos]=NewElem;
length ++ ;
}
int Queue::DelQueue()
{
int ret = elem[first];
first = (first+1)%ARRAY_SIZE;
length --;
return ret;
}
void Queue::Print()
{
int pos=elem[first];
cout << "Queue:" ;
for (int i=0;i<length;i++)
{
cout <<elem[pos] << " ";
pos = (pos+1)%ARRAY_SIZE;
}
cout << endl;
}
出现的错误:
--------------------Configuration: main - Win32 Debug--------------------
Compiling...
queue.cpp
C:\Documents and Settings\潜伏爪牙忍受\queue.cpp(21) : error C2511: 'Print' : overloaded member function 'void (void)' not found in 'Queue'
c:\documents and settings\潜伏爪牙忍受\queue.h(2) : see declaration of 'Queue'
Error executing cl.exe.
queue.obj - 1 error(s), 0 warning(s)
使用的平台是VC++6.0 请各位帮忙指导