Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #6628

Re: Does friendship extend to inner classes?

From Ruben Safir <mrbrklyn@panix.com>
Newsgroups comp.lang.c++
Subject Re: Does friendship extend to inner classes?
Date 2011-06-11 20:41 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <it0jtc$j0s$1@reader1.panix.com> (permalink)
References <4df25dc2$0$2869$7b1e8fa0@news.nbl.fi>

Show all headers | View raw


Juha Nieminen <nospam@thanks.invalid> wrote:
>  Consider the following:
> 
> //-----------------------------------------------
> class A
> {
>    class B
>    {
>        int i;
>        friend class A;
>    };
> 
>    class C
>    {
>        void foo(B&);
>    };
> };
> 
> void A::C::foo(B& b)
> {
>    b.i = 5; // Allowed or not?
> }
> //-----------------------------------------------
> 
>  It seems that gcc and Visual Studio disagree on this (gcc allows it,
> Visual Studio issues an error). Which one is right?


This code is useless since there is no public or private declarations,
no main and theorectically, friend is irrelavent to the example.


Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Does friendship extend to inner classes? Juha Nieminen <nospam@thanks.invalid> - 2011-06-10 18:09 +0000
  Re: Does friendship extend to inner classes? Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-10 13:04 -0700
    Re: Does friendship extend to inner classes? Juha Nieminen <nospam@thanks.invalid> - 2011-06-11 04:45 +0000
      Re: Does friendship extend to inner classes? Geoff <geoff@invalid.invalid> - 2011-06-12 10:53 -0700
  Re: Does friendship extend to inner classes? Ruben Safir <mrbrklyn@panix.com> - 2011-06-11 20:41 +0000
    Re: Does friendship extend to inner classes? Juha Nieminen <nospam@thanks.invalid> - 2011-06-12 14:10 +0000
    Re: Does friendship extend to inner classes? Werner <werasm@gmail.com> - 2011-06-13 03:51 -0700
  Re: Does friendship extend to inner classes? Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-06-12 23:01 +0200
    Re: Does friendship extend to inner classes? "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-12 23:31 +0200
    Re: Does friendship extend to inner classes? Juha Nieminen <nospam@thanks.invalid> - 2011-06-13 12:20 +0000
      Re: Does friendship extend to inner classes? Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-06-13 18:46 +0200

csiph-web