Topic: static and accessiblity - a mystery?


Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: Sun, 12 Feb 1995 17:15:58 GMT
Raw View
jarausch@igpm.rwth-aachen.de (Helmut Jarausch) writes:

>The following example (if not a compiler bug) shows that it is possible
>to declare but not to define a non-public item - is this by intention?

The committee decided that your code was legal, so it's a compiler bug.

>class A
>{
>// public:    // would be OK
>struct Pair{ int x,y; };
>private:
>  static Pair P;
>};
>
>A::Pair A::P={1,2};
>// ^ error(1238): class "A::Pair" is inaccessible

--
Fergus Henderson - fjh@munta.cs.mu.oz.au
all [L] (programming_language(L), L \= "Mercury") => better("Mercury", L) ;-)




Author: jarausch@igpm.rwth-aachen.de (Helmut Jarausch)
Date: 10 Feb 1995 13:23:21 GMT
Raw View
The following example (if not a compiler bug) shows that it is possible
to declare but not to define a non-public item - is this by intention?


class A
{
// public:    // would be OK
struct Pair{ int x,y; };
private:
  static Pair P;
};

A::Pair A::P={1,2};
// ^ error(1238): class "A::Pair" is inaccessible


Any help (ref to the ARM) would be appreciated.
Thank's
Helmut Jarausch
Institute of Technology
RWTH-Aachen
Germany