Sup guys it's me again. My problem this time is i cant figure out how to make a vector full of objects and pass it to a function.
Here is what this part of the program should do: Create a vector to hold objects of class Manager. Pass this vector to a function that will prompt the user for input for various variables. Create a new Manager object from the user input, push back the vector, and store the object in the new spot the vector just made.
Here is what im trying to do in main.cpp..(lots of code was removed because it was really long and no one wants to read long code)
The class is called Employee, not employee.
The task description is nonsense. push_back does not reserve space for another element, it adds an element to the vector.
So it should be database.push_back(new Manager(...));
If you want to store the objects directly, don't create them using new, i.e. database.push_back(Manager(...));
However, that won't work with inheritance, so your vector would need to store Manager objects. If you want it to be any type of Employee, you'll have to stick with pointers.
Heh. You shouldn't declare variables in the scope of a switch case.
If you need any, give the case its own block, so the variables are destroyed at the end.
1 2 3 4 5 6 7 8
switch(bla)
{
case'a':
{
int some,variables;
//...
}
}