no matching function for call

Hey all,
I have a problem with my code here, and i don't know how fix this.

Here's the code:

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "Company.h"
#include "Casual.h"
#include "Manager.h"
#include "StaffMember.h"
#include <vector>
#include <string>
#include <iostream>
#include <fstream>

using namespace std;

Company::Company()
{
      cout << "Would you like to load a file? (Y/N)" << endl;
      char FileLoadChoice;
      cin >> FileLoadChoice;
      vector<StaffMember*> VSM;
      if (FileLoadChoice == 'Y' || 'y')
      {
           string FileName;
           cout << "Enter your filename, including the path and file type." << endl;
           cin >> FileName;
           ifstream in_stream;
           ofstream out_stream;
           in_stream.open("FileName");
           in_stream >> Company::name;
           int ID;
           string WorkType, Name1, Name2;
           double Numeric1, Numeric2;

           while (WorkType != "END")
           {
                 in_stream >> WorkType >> ID >> Name1 >> Name2 >> Numeric1 >> Numeric2;
                 if (WorkType == "Manager" || WorkType == "Casual")
                 {
                    if (WorkType == "Manager")
                    {  
                       VSM.push_back(Manager::Manager(ID, (Name1 + Name2), Numeric1));
                    }
                    if (WorkType == "Casual")
                    {
                       VSM.push_back(Casual::Casual(ID, (Name1 + Name2), Numeric1, Numeric2));
                    }   
                 } 
           }  
      }
      cout << "Payroll for " << Company::name << endl;
      cout << "====================================" << endl;
      cout << "ID     Name      Type       Wage" << endl;

      
             
}



This results in the error:

38 C:\Dev-Cpp\Company.cpp no matching function for call to `std::vector<StaffMember*, std::allocator<StaffMember*> >::push_back(Manager)'

Does anyone here know how to fix this?

Cheers in advance.

VSM stores pointers to StaffMembers, not StaffMembers themselves. Construct with new.
VSM stores pointers to StaffMembers, not StaffMembers themselves. Construct with new.

Can you be more specific?
new Manager(ID, (Name1 + Name2), Numeric1)
Topic archived. No new replies allowed.