Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/147.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 错误:用于';EM::EM(…)和#x27;不匹配类中的任何';EM';_C++ - Fatal编程技术网

C++ 错误:用于';EM::EM(…)和#x27;不匹配类中的任何';EM';

C++ 错误:用于';EM::EM(…)和#x27;不匹配类中的任何';EM';,c++,C++,在我在.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{ protecte

在我在.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
\ifndef PRJET\h
#定义PRJET_h
#包括
#包括
使用名称空间std;
阶级雇员{
受保护的:
字符串名称;
int矩阵,表示;
静态积分;
公众:
雇员(字符串,整数,整数);
无效词缀();
int salaire();
};
负责班级:公共雇员{
受保护的:
雇员分命令[];
字符串负责;
公众:
负责人(字符串、字符串、整数、雇员[]、字符串);
//布尔验证雇员(int){};
//无效的外部调动(雇员){};
//无效的雇佣关系(){};
};
#endif//date\u 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;
}
#包括
#包括“PRJET.h”
#包括
使用名称空间std;
EMPLOYE::EMPLOYE(字符串n,int m,int i){
nom=n;
矩阵=m;
指数=i;
}

您的类没有用户定义的构造函数,应改为:

class EMPLOYE{
protected:
string nom;
int matricule,indice;
static int valeur ;

public:
EMPLOYE(string , int, int);
void afficher();
int salaire();
};
附言:在所有大写字母中都有类型名称是非常奇怪的,这违反了语言惯例。

C++区分大小写

姓名
EMPLOYE
和姓名
EMPLOYE
是两个不同的名称


因此,您从未真正为
EMPLOYE
声明过构造函数,这让编译器感到困惑。

为什么您要在构造函数体中分配变量,而不是使用构造函数初始化列表?看起来很奇怪而且效率很低。比较
Employe(string,int,int)
Employe::Employe(string n,int m,int i)