class foo
{
friendclass bar;
public:
// . . .
private:
int attribute_0 = 100;
std::string attribute_1 = "foo";
class bar
{
public:
void PrintBooBar()
{
//here is the problem. how access attribute_0 from foo??
std::cout << foo::attribute_0 << attribute_0 << std::endl;
}
private:
int attribute_0 = 200;
std::string attribute_1 = "bar";
} attribute_2;
}
Accessing attribute_0 in foo via foo::attribute_0 doesn't seem to work. I know I can get around this by passing the this pointer to the nested class, but I'm looking for something nicer...seems like it should be possible. I'd definitely appreciate any pointers on this. Thanks
Edit: This is for c++11 with VS 2013 compiler. My understanding is that in c++11 nested classes should have access to enclosing private members?