Thread View: comp.std.c++
2 messages
2 total messages
Started by Martin Hitz
Tue, 23 Apr 1991 03:05
protected derivation
Author: Martin Hitz
Date: Tue, 23 Apr 1991 03:05
Date: Tue, 23 Apr 1991 03:05
30 lines
1432 bytes
1432 bytes
Recently, I came across page 196 of the ARM where the syntax of an
<access-specifier> for base classes in the definition of derived
classes is given:
<access-specifier>:
private
protected
public
However, there is no mention of the semantics of the protected keyword
in this context, especially not in section 11.2 (pages 242ff).
I tried
class B {};
class D : protected B {};
but it was not accepted by g++ nor by Zortech.
I could imagine some use for this construction, however. A class D could
decide to grant access to formerly public members of B to its (D's)
decendants, but not to ordinary clients. I.e., protected could "make"
public B members protected D members, just like public leaves them
public and private makes them private. Protected members of B could
probably stay protected by "protected derivation".
I suggest either to adopt such a rule or to remove protected from the
corresponding syntax.
Martin Hitz (hitz@csi.uottawa.ca)
Re: protected derivation
Author: [Doug Landauer]
Date: Wed, 24 Apr 1991 20:42
Date: Wed, 24 Apr 1991 20:42
14 lines
1190 bytes
1190 bytes
> [The] <access-specifier> for base classes in the definition of derived
> classes [ ... includes "protected" ... ]
> However, there is no mention of the semantics ...
> I suggest either to adopt such a rule or to remove protected from the
> corresponding syntax.
The latest Draft working paper accepted by X3J16 does describe the meaning
of this construct; at also includes some examples showing its use.
In other words, yes, it is expected that protected derivation will
be ("always has been", say some) a part of the C++ language.
--
Doug Landauer - Sun Microsystems, Inc. - Languages - landauer@eng.sun.com
Matt Groening on C++: "Our language is one great salad."
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads