I am currently making a project where in a class I will be taking in a large amount of variables from a user input. Is there a way to stop something like this:
class Person
{
std::string firstName,
lastName,
DoB,
address;
int personID,
durationMins,
totalVisits;
void setValues(std::string values[])
{
firstName = values[0];
lastname = values[1];
DoB = values[2];
// ... etc
}
};
I would like to avoid having a mass of lines dedicated to variable assignment, though I do not know if this is even possible. Any help would be appreciated, thank you.