Hey guys, this is my first post to the forums so please excuse the newness if I have posted something wrong. I am having trouble with trying to add class objects to a vector. I am trying to have a user be able to add, remove, clear, and display employee's from a vector but I am not sure if I am going about it correctly. I am also getting an error: expected type specifier at line 112 and I am not sure why. Thank you in advance for the help!
so please excuse the newness if I have posted something wrong
The fact that you used code tags makes you a genius first-poster on this site.
Don't put local variables in the class definition! That is a bad thing to do since it makes every Employee structure that much bigger for absolutely no reason. Local variables belong in the member functions that use them. So move all of the member variables of Employee that don't start with m_ into the functions. And Staff probably shouldn't have iter (assuming it's basically a local variable, too).
It is unusual to include ostream when you've already included iostream, which is guaranteed to include both istream and ostream.
It's not usually necessary to include <new>. And you're not using <tuple>, <algorithm>, or <cstdlib>.
As for the problem on line 112, what is pEmp? Presumably it should be Employee.
This is backwards:
fName + lName = m_Name;
As you have no main, so I can't actually run your program.
Thank you for the heads up on the local variables, I really did not know how to go about storing all of the class objects into the vector, I found an example that declared the vector in a new class and used pointers to the employee class.
As for the pEmp, I was trying to create a new pointer to the employee class. I am not sure why I was getting the error message though. I have just gotten stuck at this point, I was trying to get the Employee class objects to store in a vector so that I can add and remove new employees; and then be able to display or clear the vector of employees.