I wanted to do new because eventually what I want to do is something like this:
Also, if I explicitly call an instance of employee, like employee newemployee(name,payrate)...
bool goodinput = false;
while (goodinput == false)
cout << "Welcome to the employee database, what would you like to do?" << endl // prompt
<< "1. Add an employee" << endl << "2. Modify an employee" << endl;
getline(cin, input); //get input
stringstream(input) >> selection; //extract selection integer
if (selection == 1)
goodinput = true;
else if (selection == 2)
goodinput = false;
goodinput = false; // invalid selection - continue loop
cout << "Please enter a valid selection, 1 or 2." << endl;
Doesn't that instance only last for the scope of the function?
If not I don't need new at all, and I can just return a reference.