Possible Duplicate:
Is this key-oriented access-protection pattern a known idiom?
I have class A and class B. I want class A to access one of class B‘s private functions; but only that, not everything else. Is that possible?
Some kind of example:
class A {
//stuff
};
class B {
int r; // A cant use this
MagicFriendKeyword A void func(); // A can use this
public:
...
};
If there is one (or few) members functions in class A, that want to use class B’s private member functions, then you can declare those one/few functions as friend. E.g.
See http://en.wikipedia.org/wiki/Friend_function