Topic: friend class
Author: jason@cygnus.com (Jason Merrill)
Date: Mon, 19 Sep 1994 18:57:41 GMT Raw View
>>>>> U51272 <U51272@uicvm.uic.edu> writes:
> I have a program in which all the functions in one particular class
> should have read / write access to all the data members of another
> particular class. using the AT&T C++ compiler, the construction below
> works (declaring the second class 'friend' to the first class).
> however, this doesn't work using the gnu compiler. does anyone know of
> an alternate construct (other than separately declaring each function
> in class XXX 'friend' to class YYY) for gnu C++?
> class XXX { class YYY {
> private:
> short x1; friend XXX;
> public:
> short fn1( ); public:
> short fn2( ); short y1;
> }; short y2;
> }:
The portable syntax is 'friend class XXX;'.
Jason
Author: <U51272@uicvm.uic.edu>
Date: Wed, 14 Sep 1994 12:45:10 CDT Raw View
I have a program in which all the functions in one particular class
should have read / write access to all the data members of another
particular class. using the AT&T C++ compiler, the construction below
works (declaring the second class 'friend' to the first class).
however, this doesn't work using the gnu compiler. does anyone know of
an alternate construct (other than separately declaring each function
in class XXX 'friend' to class YYY) for gnu C++?
class XXX { class YYY {
private:
short x1; friend XXX;
public:
short fn1( ); public:
short fn2( ); short y1;
}; short y2;
}:
thanks in advance to all who reply.
Leslie Schwartzman
u51272@uicvm.uic.edu