Topic: private nested class - how to return?
Author: hopps@mmm.com (Kevin J Hopps)
Date: 15 Nov 1994 13:30:08 GMT Raw View
Larry Hunter (lhunter@acm.org) wrote:
> In article <39dip6$p9o@dawn.mmm.com>, hopps@mmm.com (Kevin J Hopps) says:
> >
> >How to I write the implementation file for the function f() below?
> >
> >class X
> >{
> >private:
> > class Y { ... };
> > Y* f();
> >};
> >
> >When I write
> > X::Y* X::f() { ... }
> >
> >The warning is "X::Y is not accessible from file level."
> >
> Borland C++ 4 accepts it. What compiler are you using?
SunSoft C++ 4.0
--
Kevin J. Hopps e-mail: kjhopps@mmm.com
3M Company phone: (612) 737-3300
3M Center, Bldg. 235-2D-45 fax: (612) 737-2700
St. Paul, MN 55144-1000 Opinions are my own. I don't speak for 3M.
Author: pkt@lpi.liant.com (Scott Turner)
Date: Mon, 7 Nov 1994 16:42:38 GMT Raw View
In article <39hk7s$36v@giga.bga.com>, lhunter@acm.org (Larry Hunter) wrote:
> In article <39dip6$p9o@dawn.mmm.com>, hopps@mmm.com (Kevin J Hopps) says:
> >
> >How to I write the implementation file for the function f() below?
> >
> >class X
> >{
> >private:
> > class Y { ... };
> > Y* f();
> >};
> >
> >When I write
> > X::Y* X::f() { ... }
> >
> >The warning is "X::Y is not accessible from file level."
> >
> Borland C++ 4 accepts it.
The standards committee had consensus on this a couple of years ago,
that the above function definition should be accepted, i.e. Borland is right.
Unfortunately, consensus is several steps removed from getting the decision
into the standard. The working paper is still imprecise in addressing the
question, and I couldn't say whether consensus still exists.
--
Scott Turner
Liant Software Corp., Framingham, Massachusetts, USA
pkt@lpi.liant.com
Author: hopps@mmm.com (Kevin J Hopps)
Date: 4 Nov 1994 15:08:22 GMT Raw View
How to I write the implementation file for the function f() below?
class X
{
...
private:
class Y { ... };
Y* f();
};
When I write
X::Y* X::f() { ... }
The warning is "X::Y is not accessible from file level."
I understand this perfectly, but it seems like a reasonable thing to
allow when writing a private function. Is this a problem with the
compiler? With the standard?
--
Kevin J. Hopps e-mail: kjhopps@mmm.com
3M Company phone: (612) 737-3300
3M Center, Bldg. 235-2D-45 fax: (612) 737-2700
St. Paul, MN 55144-1000 Opinions are my own. I don't speak for 3M.
Author: jason@cygnus.com (Jason Merrill)
Date: Fri, 4 Nov 1994 21:33:55 GMT Raw View
>>>>> Kevin J Hopps <hopps@mmm.com> writes:
> How to I write the implementation file for the function f() below?
> class X
> {
> ...
> private:
> class Y { ... };
> Y* f();
> };
> When I write
> X::Y* X::f() { ... }
> The warning is "X::Y is not accessible from file level."
> I understand this perfectly, but it seems like a reasonable thing to
> allow when writing a private function. Is this a problem with the
> compiler? With the standard?
Both? There was some discussion of revising access control for nested
types, but I don't think it ever went anywhere. But it does seem that your
compiler is being unreasonable.
Jason
Author: lhunter@acm.org (Larry Hunter)
Date: 6 Nov 1994 03:57:48 GMT Raw View
In article <39dip6$p9o@dawn.mmm.com>, hopps@mmm.com (Kevin J Hopps) says:
>
>How to I write the implementation file for the function f() below?
>
>class X
>{
>private:
> class Y { ... };
> Y* f();
>};
>
>When I write
> X::Y* X::f() { ... }
>
>The warning is "X::Y is not accessible from file level."
>
Borland C++ 4 accepts it. What compiler are you using?