Ok, so here is what I did so far. Like I said I'm not used to vectors so its pretty new to me. When you said for me to create using new do you mean like this?
salariedEmployee = new Employee;
salariedEmployee = new SalariedEmployee;
As for the push_back command, I'm not sure how to use that. Here is my code. Do I create the new objects inside each case? If your wondering what the input will look like from the file it will be as follows.
S firstName lastName socialSecurityNumber weeklySalary birthdate
H firstName lastName socialSecurityNumber wage hours birthdate
C firstName lastName socialSecurityNumber grossSales commissionRate birthdate
B firstName lastName socialSecurityNumber grossSales commissionRate baseSalary birthdate
S Tom Smith 111-11-1111 800 09/10/1942
H Karen Price 222-22-2222 16.75 40 01/01/1982
C Sue Jones 333-33-3333 10000 .06 05/31/1980
B Bob Lewis 444-44-4444 5000 .04 300 10/04/1950
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <fstream>
// include definitions of classes in Employee hierarchy
#include "Date.h"
#include "Employee.h"
#include "SalariedEmployee.h"
#include "HourlyEmployee.h"
#include "CommissionEmployee.h"
#include "BasePlusCommissionEmployee.h"
using namespace std;
int main()
{
vector < Employee * > employees;
string firstName;
string lastName;
string ssn;
double salary;
double hourlyWage;
double hoursWorked;
double sales;
double rate;
int month;
int day;
int year;
char type;
fstream indata; // The file to be opened
indata.open("employee.txt"); // Open the file to be read
if(!indata)
{
cout << "Error: file could not be opened" << endl;
exit(1);
}
do
{
indata>>type; …