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


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

Re: Does friendship extend to inner classes?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!nx02.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!news-xxxfer.readnews.com!panix!panix.com!mrbrklyn
From Ruben Safir <mrbrklyn@panix.com>
Newsgroups comp.lang.c++
Subject Re: Does friendship extend to inner classes?
Date Sat, 11 Jun 2011 20:41:16 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 33
Message-ID <it0jtc$j0s$1@reader1.panix.com> (permalink)
References <4df25dc2$0$2869$7b1e8fa0@news.nbl.fi>
NNTP-Posting-Host panix2.panix.com
X-Trace reader1.panix.com 1307824876 19484 166.84.1.2 (11 Jun 2011 20:41:16 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Sat, 11 Jun 2011 20:41:16 +0000 (UTC)
User-Agent tin/1.8.3-20070201 ("Scotasay") (UNIX) (NetBSD/5.1 (i386))
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:6628

Show key headers only | 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