定义了一个再简单不过的类,可是编译时说我重复声明,快进来帮我看看怎么回事吧!
我New了一个Unit,在Unit.h中定义了如下类:
class apermit
{
public:
string punit; //申请单位名称
string pdate; //申请日期
string pmaster; //单位负责人
string pfperson; //法人代表
string paddress; //申请单位地址
string ptel; //申请单位电话
string pfassets; //固定资产
string pcountw;
string pcheckw;
string pcertid;
string parea;
string pwill;
string peconom;
string pfile;
string pestab;
string pnotion;
string pndate;
string mgetdate;
string mephor;
string mefnotion;
string mdealephor;
string mdealdate;
string mpitem; //审批许可项目
string mpdind;
string mpidate;
string mpassdate;
string mpassid;
string mvalidf;
string mvalidt;
string mvkind;
string mtrans;
string memo;
string minitid;
string isnew;
apermit(void){ //构造函数
this->punit = "卫生局"; //申请单位名称
this->pdate = "2003-04-17"; //申请日期
this->pmaster = ""; //单位负责人
this->pfperson = "张三"; //法人代表
this->paddress = "明山区育人街"; //申请单位地址
this->ptel = ""; //申请单位电话
this->pfassets = ""; //固定资产
this->pcountw = "";
this->pcheckw = "";
this->pcertid = "";
this->parea = "";
this->pwill = "";
this->peconom = "";
this->pfile = "";
this->pestab = "";
this->pnotion = "";
this->pndate = "";
this->mgetdate = "";
this->mephor = "";
this->mefnotion = "";
this->mdealephor = "";
this->mdealdate = "";
this->mpitem = "这个项目没人知道"; //审批许可项目
this->mpdind = "";
this->mpidate = "";
this->mpassdate = "2003-04-07";
this->mpassid = "20031231533";
this->mvalidf = "2003-05-07";
this->mvalidt = "2004-05-06";
this->mvkind = "";
this->mtrans = "";
this->memo = "";
this->minitid = "";
this->isnew = "";
};
string yearofdt(string dt){
return dt.substr(0,3);
};
string monthofdt(string dt){
return dt.substr(5,6);
};
string dateofdt(string dt){
return dt.substr(8,9);
};
string subid(string id){
return id.substr(4,12);
};
} ;
就这么简单的一个类,编译时给出如下错误提示:
[C++ Error] thepermit.h(11): E2238 Multiple declaration for 'apermit'
[C++ Error] thepermit.h(10): E2344 Earlier declaration of 'apermit'
[C++ Error] main.cpp(38): E2285 Could not find a match for 'apermit::operator =(apermit *)'
错误行指示在类定义的第一行: class apermit{ 这一行
请高手出招纠错!!!!