Topic: friend
Author: rosten@serv.net (David Rosten)
Date: 1997/11/22 Raw View
Is there any syntax for 'friend' that would allow one to specify only specific
member data and functions be accessible by the friend? In other words...
class A
{
protected:
void foo1();
void foo2();
int x;
int y;
}
class B
{
}
I may want class B to be a "selective" friend of A: it should be able to
access foo1() and 'x', but not foo2() nor 'y'. Of course, I could make foo1()
and 'x' public, but I really don't want all other classes to access these.
Is something like...
class A
{
protected:
friend class B void foo1();
void foo2();
friend class B int x;
int y;
}
..permissible (in principal). If so, what's the syntax?
Thanks. I'd appreciate a CC e-mail to any response.
:-Dave
rosten@serv.net