A C++ private member function problem# Programming - 葵花宝典
lz
1 楼
Hello,
I am confused by the following code.
class A{
private:
void init();
public:
void foo(A& a);
}
void A::foo(A& a)
{
a->init();
}
This code passes c++ compliling. My question is that init()
is a private function, how can that be called in foo()?
Thank you!
I am confused by the following code.
class A{
private:
void init();
public:
void foo(A& a);
}
void A::foo(A& a)
{
a->init();
}
This code passes c++ compliling. My question is that init()
is a private function, how can that be called in foo()?
Thank you!