[cfe-dev] Beginnings of C++ access control (and question about	standard)
    Mike Stump 
    mrs at apple.com
       
    Wed Apr 22 11:01:16 PDT 2009
    
    
  
On Apr 22, 2009, at 6:18 AM, Tim Northover wrote:
> I seem to have found similar in an even simpler example where hiding  
> private
> bases doesn't come up:
>
> class N {
> protected:
>        int m;
> };
>
> class P : public N {
>  int getX(N n) {
>    return n.m;
>  }
> };
>
> g++ (and comeau) complain that m is protected here, but I just can't  
> see how
> this can fail the condition:
>
> "— m as a member of N is protected, and R occurs [...] or in a  
> member or
> friend of a class P derived from N, where m as a member of P is  
> public,
> private, or protected, or"
Keep reading the standard...   Try all of 11.5  Protected member  
access, paying special attention to all the examples, then work back  
to the wording that gives rise to the examples.
    
    
More information about the cfe-dev
mailing list