c++ - 错误:“EM::EM(...)”的原型与“EM”类中的任何原型都不匹配
问题描述
在我在 .h 文件中声明类并开始工作后,我添加了一些函数和库,然后出现了这个错误!
(错误:'EMPLOYE::EMPLOYE(std::string, int, int)' 的原型与类 'EMPLOYE' 中的任何一个都不匹配)
这是两个文件
PRJET.h
#ifndef PRJET_h
#define PRJET_h
#include <iostream>
#include <string>
using namespace std;
class EMPLOYE{
protected:
string nom;
int matricule,indice;
static int valeur ;
public:
Employe(string , int, int);
void afficher();
int salaire();
};
class RESPONSABLE : public EMPLOYE{
protected:
EMPLOYE SUBORDONE[];
string responsable;
public:
Responsable(string,string,int,EMPLOYE[],string);
//bool verifierEmploye(int){};
//void ajouterEmploye(Employe){};
//void afficheEmploye(){};
};
#endif // date_H
PRJET.cpp
#include <iostream>
#include "PRJET.h"
#include <string>
using namespace std;
EMPLOYE::EMPLOYE(string n , int m ,int i){
nom=n;
matricule=m;
indice=i;
}
解决方案
C++ 区分大小写。
名字EMPLOYE
和名字Employe
是两个不同的名字。
因此,您实际上并没有为 声明构造函数EMPLOYE
,从而使编译器感到困惑。