首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

overloaded member function 'void (void)' not found ?解决思路

2012-11-05 
overloaded member function void (void) not found ??请教各位高手:我在类的头文件定义里面声明了函数c

overloaded member function 'void (void)' not found ??
请教各位高手:
 我在类的头文件定义里面声明了函数 
const int ARRAY_SIZE =10;
class Quenue {
public :
void Init();
void EnQuenue(int newElem);
int DelQuenue ();
int GetLength(){ return length;}
  void Print() const ; 
 int elem [ARRAY_SIZE];
int first ;
int length;
};
在源文件中定义函数时候 
# include<iostream.h>
#include "queue.h"
void Quenue ::Init()
{
first =length=0;
}

void Quenue :: EnQuenue(int newElem)
{
int pos=(first+length)%ARRAY_SIZE;
elem[pos]=newElem;
length++;
}
int Quenue::DelQuenue()
{
int ret =elem[first];
first=(first+1)%ARRAY_SIZE;
length--;
return ret;
}

void Quenue::Print()
{
int pos=first;
cout <<"Quenue:";
for(i=0;i<length;i++)
{
cout <<elem[pos]<<" ";
pos=(pos+1)%ARRAY_SIZE;
}
cout <<endl;
} //// print 函数部分报错 overloaded member function 'void (void)' not found??

[解决办法]
为什么要 在申明时候加const ?

[解决办法]
声明是的时候加了在实现的也要加

热点排行