I dont know if what I want have to be done using inheritance or simply writing correct 'friend' keyword.
I have the next code :
ClassA
public :
void methodA
private :
ClassB my_classb
ClassA
public :
void methodA
private :
ClassB my_classb
To copy to clipboard, switch view to plain text mode
ClassB
void methodB
ClassB
void methodB
To copy to clipboard, switch view to plain text mode
void ClassB::methodB
{
if (condition)
classB.methodA ();
}
void ClassB::methodB
{
if (condition)
classB.methodA ();
}
To copy to clipboard, switch view to plain text mode
As you can see I'd want to acces to a methodA from metodB.
I can do the work using inheritance, but I would not want access to all public members, only to one of them.
I have see also the friend keyword, but I dont know how to write the correct code.
I'm sure that this is easy to do, but I dont find the way.
Any help will be appreciated.
Bookmarks