class foo
{
bar b;
someFunction()
{
b.alphaObj->someFunctionOfAlpha();
}
};
class bar
{
friend class foo;
// many more friends
private:
alpha *alphaObj;
};
How do I remove the friend dependency without exposing the private members with getters and setters. I understand friend classes could help in enhancing encapsulation but there are a lot of friend classes defined in my class exposing the private members to all. Hence I am thinking of a better approach and any help is appreciated.