Thread overview
another access problem:
Aug 09, 2004
Arjan Knepper
Aug 12, 2004
Heinz Saathoff
BUG report (was: another access problem:)
Aug 12, 2004
Arjan Knepper
August 09, 2004
----------------------------------------<snip>---------------------------
#include <stdio.h>


class  ThePrivateBase
{
   public :
      ThePrivateBase () {}
      ThePrivateBase ( void *_a ) {}
      ThePrivateBase ( const ThePrivateBase &_a );
};


class  Derived : private ThePrivateBase
{
   public :
      Derived () {}
      Derived ( int *_a ) : ThePrivateBase ( _a ) {}
      Derived ( const ThePrivateBase &_q ) : ThePrivateBase ( _q ) {}
#if defined _HUH_
      Derived ( const Derived &_q ) : ThePrivateBase ( _q ) {}
#endif
};



int  main ()
{
   Derived  d;

   return ( 0 );
}

----------------------------------------<snip>---------------------------
Compiling with -D_HUH_ gives an error:
inh.cpp(19) : Error: member 'ThePrivateBase' of class 'Derived' is not accessible

According to my (limited) knowledge it should be accessable. Or am I wrong?

Thanks,
Arjan
August 12, 2004
Hello Arjan,

Arjan Knepper wrote...
> #include <stdio.h>
> 
> 
> class  ThePrivateBase
> {
>     public :
>        ThePrivateBase () {}
>        ThePrivateBase ( void *_a ) {}
>        ThePrivateBase ( const ThePrivateBase &_a );
> };
> 
> 
> class  Derived : private ThePrivateBase
> {
>     public :
>        Derived () {}
>        Derived ( int *_a ) : ThePrivateBase ( _a ) {}
>        Derived ( const ThePrivateBase &_q ) : ThePrivateBase ( _q ) {}
> #if defined _HUH_
>        Derived ( const Derived &_q ) : ThePrivateBase ( _q ) {}
> #endif
> };
> 
> 
> 
> int  main ()
> {
>     Derived  d;
> 
>     return ( 0 );
> }
> 
> ----------------------------------------<snip>---------------------------
> Compiling with -D_HUH_ gives an error:
> inh.cpp(19) : Error: member 'ThePrivateBase' of class 'Derived' is not
> accessible
> 
> According to my (limited) knowledge it should be accessable. Or am I wrong?


Yes, this should be allowed. First I wasn't sure, so I asked this in the german C++ newsgroup and got a confirmation that the _HUH_ part is valid. I also checked with PC-Lint which also accepts this.


- Heinz
August 12, 2004
Heinz Saathoff wrote:
> Hello Arjan,
> 
> Arjan Knepper wrote...
> 
>>#include <stdio.h>
>>
>>
>>class  ThePrivateBase
>>{
>>    public :
>>       ThePrivateBase () {}
>>       ThePrivateBase ( void *_a ) {}
>>       ThePrivateBase ( const ThePrivateBase &_a );
>>};
>>
>>
>>class  Derived : private ThePrivateBase
>>{
>>    public :
>>       Derived () {}
>>       Derived ( int *_a ) : ThePrivateBase ( _a ) {}
>>       Derived ( const ThePrivateBase &_q ) : ThePrivateBase ( _q ) {}
>>#if defined _HUH_
>>       Derived ( const Derived &_q ) : ThePrivateBase ( _q ) {}
>>#endif
>>};
>>
>>
>>
>>int  main ()
>>{
>>    Derived  d;
>>
>>    return ( 0 );
>>}
>>
>>----------------------------------------<snip>---------------------------
>>Compiling with -D_HUH_ gives an error:
>>inh.cpp(19) : Error: member 'ThePrivateBase' of class 'Derived' is not accessible
>>
>>According to my (limited) knowledge it should be accessable. Or am I wrong?
> 
> 
> 
> Yes, this should be allowed. First I wasn't sure, so I asked this in the german C++ newsgroup and got a confirmation that the _HUH_ part is valid. I also checked with PC-Lint which also accepts this.
> 
> 
> - Heinz

Thanks!

Than now this email is a compiler bug report.

Arjan