A rather old C++ book I have says that one class may be declared a friend class of a second, and then the first class can access the private data of the second. I tried this example
#include <iostream.h>
class secret
{ friend class not;
private :
int a;
};
class not
{ public:
not (int x) // constructor
{ secret.a = x;}
void printout()
{ cout << secret.a << endl; }
};
main()
{ not testclass(4);
testclass.printout();
}
The compiler didn't like "secret.a" nor was it happier when I relaced it by just 'a'. Anyone familiar with the friend classes?