Ok, so say I have a class such as this:
And I had a container for it like this:Code:class fruit
{
private:
int weight;
string name;
string color;
}
Assume that I had a public function that would set a name, weight, and color based on three parameters.Code:vector<fruit> Thing;
Now, how would I add an instance of "fruit" (containing weight, name, and color) to the vector Thing?
Thing.push_back(44, "bleh", "sdflkj") wouldn't work (would it?).
What about something like, "Thing.public_function(44, "name", "color")? Then could I acess that through "Thing[0]"?
*Sorry if this post sounds extremly stupid*
EDIT:Ignore the above, I figured it out. I am an idiot