I am trying to store either the objects of a base class (employee
), or pointers to the objects inside a vector/array in another class (finance
) object. The number of employee objects depends on the user, so it needs to work dynamically. So far I have this:
finance.h
#ifndef FINANCE
#define FINANCE
#include "freight.h"
class finance
{
public:
finance();
~finance();
};
#endif // FINANCE
finance.cpp
#include "finance.h"
using namespace std;
finance::finance()
{
vector<employee *> vemployee; //first problem line
}
finance::~finance()
{
}
main.cpp
void add_manager()
{
string name;
name = get_string_input("Please input the name of the employee.");
vManagers.push_back(new manager(name)); //second problem line
ask_employee();
}
Main.cpp
also has includes on all my .h
files as well as finance.cpp
. I am getting errors on both main and finance.cpp
saying about expected primary expressions and not declared in scope.
Note:
I'm clearly doing something wrong but I honestly have no idea as vectors is something I haven't been taught yet. If there's a way to do it with arrays I don't mind trying that either.