Employee class with 3 files help with string in Constructor
Dec 11, 2013 at 1:20am UTC
The first file is the header file and it saying there is an error with the strings so maybe I did something wrong with the strings. There are 3 files a Declaration, Implementation, and the file that uses the other 2. First I want to understand and fix the problems from the Header and maybe I can fix the rest.
Any help is appreciated thank you in advance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#ifndef _EMPLOYEE_H
#define _EMPLOYEE_H
#include <string>
class Employee
{
private :
string name, idNumber, department, position;
int yearsWorked;
public :
Employee(string, string, string, string, int );
Employee(string, string);
Employee();
void setName(string);
void setID(string);
void setDepartment(string);
void setPosition(string);
bool setYearsWorked(int );
string getName() const ;
string getID() const ;
string getDepartment() const ;
string getPosition() const ;
int getYearsWorked() const ;
};
#endif
Dec 11, 2013 at 1:37am UTC
maybe std::string
Dec 11, 2013 at 1:42am UTC
isn't that the same as the #include <string>
Dec 11, 2013 at 1:49am UTC
no -- you either need to put :
using namespace std;
or you need to use std::string
instead of just string
Dec 11, 2013 at 2:05am UTC
I didn't think about that after putting it in it fixed it. Now I only have to fix the formatting of the output. Thanks man I greatly appreciate it.
Topic archived. No new replies allowed.