I have two classes, I'll call them "foo" and "bar". "foo" has two public members: (a string for its name and a vector of type "bar").
class bar {
//not important
};
class foo {
public:
std::string fooName;
std::vector<bar> bars;
}
If I have an element of bars, how can I access and print its corresponding fooName? I'm thinking about something along these lines, but I don't know how to fill in the blank:
std::cout << bars[index].__________.fooName;
When I try googling an answer, I can only find people asking about accessing private members of other classes.