I have a class with private strings and after I set information I want to the given strings in that class I need to push that data to a vector, which is stored privately in a separate class...I feel as though my code makes logical sense but obviously I am missing a step as it pushes back blank data...a summery of the code is here
class person{
private:
string name;
string age;
string location;
public:
//general gets and sets are coded here, etc..
};
class people{
private:
vector<person> pplgroup;
public:
void pushbackppl(Person Guy){
pplgroup.push_back(Guy);
}
};
void storeinfo(){
person Guy;
people Everyone;
Guy.setAge("Twenty");
Guy.setName("John");
Guy.setLocation("USA");
Everyone.pushbackppl(Guy);
}
Is my method of pushbackppl wrong to do? I am very confused as to what is going on as the vector inside class Everyone is pushing back as it should, but not the data, just emptiness.