Possible Duplicate:
What are access specifiers? Should I inherit with private, protected or public?
I am looking for some code or design pattern to grant access to a private method from another class (C++).
Let's say I have 1 class OBJ1 :
class OBJ1
{
public:
void method1();
void method2();
}
And another class OBJ2, which instantiate OBJ1 :
class OBJ2
{
public:
void method3()
{
my_obj.method1();
}
private:
OBJ1 my_obj;
}
Is there a way to access OBJ2::my_obj.method2()
from other classes (this method only) ?