🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3382

Re: Name lookup for base class (aka strange thing)

#3382
From: John E. Potter
Date: Tue, 20 Feb 1996 18:46
47 lines
2216 bytes
"Problem" duplicated with IBM xlC.

class B {
	protected :
		struct B1 {
				int i;
			};
	};
class D : public B {
	friend struct D1;
	public :
		D::B1 b1; // ok B::B1 is accessable to D.
	protected :
		struct D1 : public D::B1 {
				// error: protected member "B::B1" cannot be accessed.
			};
	};
D::B1 b1; // error: protected member "B::B1" cannot be accessed.
D d;
int x(d.b1.i);  // ok d.b1 is public and so is d.b1.i.


ARM pg187: "Member functions of a nested class have no special access to
members of an enclosing class; they obey the usual access rules".

The nested class declaration has no more right to inherit from the
protected types of the enclosing class than do its member functions
to access the protected members.  Although not explicitly stated, this
seems consistent.  Expert opinion appreciated.

For a concrete example, consider Stroustrup, "The C++ Programming Language",
Section 8.3.  Let B == slist_base, B1 == slink, D == Slist, D1 = Tlink.
In that case, it is D : private B and the error messages change to
private member "B::B1".

It seems like a good idea to move the links into the protected areas of
the lists; however, it is not possible.

Enjoy,
John
---
[ To submit articles: Try just posting with your newsreader.  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 
]
Technical Details
Message-ID: <9602181725.AA26252@falcon.lhup.edu>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: jpotter@falcon.lhup.edu (John E. Potter)
Newsgroups: comp.std.c++
Subject: Re: Name lookup for base class (aka strange thing)
Date: 20 Feb 1996 10:46:18 PST
Organization: -
Approved: austern@isolde.mti.sgi.com
Message-ID: <9602181725.AA26252@falcon.lhup.edu>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: Sun, 18 Feb 1996 12:25:02 -0500
X-Newsreader: TIN [version 1.2 PL2]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMSoXBky4NqrwXLNJAQGq8QH/eEHrBAFoiNieb/SbSh8tSDwHJBolQQsv
 zi6IBW39HLU/BjPRsvN1ZWjzv47je4Mr4ZRGncCStjrLEZmgl2acYA==
 =l7pX
Originator: austern@isolde.mti.sgi.com