在.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
的构造函数,从而混淆了编译器。
您的类没有用户定义的构造函数,应该是这样的:
class EMPLOYE{
protected:
string nom;
int matricule,indice;
static int valeur ;
public:
EMPLOYE(string , int, int);
void afficher();
int salaire();
};
附言:全大写的类型名是非常奇怪的,这违反了语言惯例。