invalid conversion from 'employee' to 'char'

Im getting a this error and I can't figure out whay can somebody help
error: invalid conversion from ‘employee*’ to ‘char’ [-fpermissive]
x.push_back(e);
^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 depot::depot()
 10 
 11 {
 12 employee* w(string n,int i,int g);
 13 string i;
 14 string n,g;
 15 string x;
 16 ifstream fin("employee.txt");
 17 while (!fin.eof())
 18 {
 19 
 20 getline(fin,i,'|');
 21 if(fin.eof())
 22         break;
 23 getline(fin,n,'|');
 24 getline(fin,g);
 25 employee* e = new employee(n,atof(i.c_str()),atof(g.c_str()));
 26 
 27 
 28 x.push_back(e);//where im getting the error
 29 }
 30 fin.close();

A string consists out of characters and the function
push_back(char); //expects a char inside the parentheses
But you call it like this:
1
2
3
4
5
6
7
8
9
x.push_back(e)  // e is a pointer to an object of type employee 
//(this is not a char! ;)

//Working examples for this would be:
x.push_back('A');
// or
char c = 'B';
x.push_back(c);
Last edited on
Thanks for your help.
Topic archived. No new replies allowed.