F
Fedor Rodikov
Could anybody explain me how the following code snippet is compiled?
According to the paragraph 11.8 of C++ standard the nested and
enclosing
classes obey usual access rules, but my compiler doesn't complain.
struct A
{
void foo()
{
B::bar1();
B::bar2( *this );
}
struct B
{
static void bar1()
{
init1();
}
static void bar2( A& a )
{
a.init2();
}
};
private:
static void init1() {}
void init2() {}
};
int main()
{
A a;
a.foo();
}
Thanks in advance!
According to the paragraph 11.8 of C++ standard the nested and
enclosing
classes obey usual access rules, but my compiler doesn't complain.
struct A
{
void foo()
{
B::bar1();
B::bar2( *this );
}
struct B
{
static void bar1()
{
init1();
}
static void bar2( A& a )
{
a.init2();
}
};
private:
static void init1() {}
void init2() {}
};
int main()
{
A a;
a.foo();
}
Thanks in advance!