Topic: [basic.lookup.classref] par. 3 example: error?


Author: "Paul Black" <paul.black@vf.vodafone.co.uk>
Date: 1997/02/26
Raw View
sergey@cis.ohio-state.edu (Sergey Zhupanov) wrote:
> Folks,
>
> In the example in Draft Standard Dec. 2, 1996, page 3-19, the example
> on top of the page:
>
> The line that reads:
>         e.B::a = 0;       // ok, only one A:a in E
>
> since B is defined as:
>         struct B: virtual A { };
>
> isn't A::a private in B, and therefore inaccessible in e?

No. Public is assumed when the derived class is a struct.
Private is the default for a class.

Paul
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: tony@online.tmx.com.au (Tony Cook)
Date: 1997/02/26
Raw View
Sergey Zhupanov (sergey@cis.ohio-state.edu) wrote:
: Folks,

: In the example in Draft Standard Dec. 2, 1996, page 3-19, the example
: on top of the page:

: The line that reads:
:  e.B::a = 0;       // ok, only one A:a in E

: since B is defined as:
:  struct B: virtual A { };

: isn't A::a private in B, and therefore inaccessible in e?

No.  A is a struct, so it's default access is public [class.access],
and B is a struct so by default it's base classes access is public
[class.access.base]

--
        Tony Cook - tony@online.tmx.com.au
                    100237.3425@compuserve.com
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: sergey@cis.ohio-state.edu (Sergey Zhupanov)
Date: 1997/02/25
Raw View
Folks,

In the example in Draft Standard Dec. 2, 1996, page 3-19, the example
on top of the page:

The line that reads:
 e.B::a = 0;       // ok, only one A:a in E

since B is defined as:
 struct B: virtual A { };

isn't A::a private in B, and therefore inaccessible in e?

thanks,
  sergey
Thanks,
  sergey
----------------------------------
Email: sergey@cis.ohio-state.edu
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]