From -4704716939814386347
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc772,e4551d1072848803
X-Google-Attributes: gidfc772,public
X-Google-Thread: f78e5,e4551d1072848803
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-11-30 04:56:39 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsfeed.cs.wisc.edu!newshub.sdsu.edu!newspeer.cts.com!usc.edu!rpi!not-for-mail
From: Martin von Loewis <loewis@informatik.hu-berlin.de>
Newsgroups: comp.lang.c++.moderated,comp.std.c++
Subject: Re: Omitting the access specifier of a base class
Date: 30 Nov 2001 07:57:06 -0500
Organization: Humboldt University Berlin, Department of Computer Science
Lines: 38
Sender: cppmods@netlab.cs.rpi.edu
Approved: kuehl@fmi.uni-konstanz.de
Message-ID: <j4ofll33n5.fsf@informatik.hu-berlin.de>
References: <3C051430.3AE0E9C2@bawi.org>
NNTP-Posting-Host: netlab.cs.rpi.edu
X-Auth: PGPMoose V1.1 PGP comp.std.c++
	iQBFAgUAPAb6KeEDnX0m9pzZAQHC2QGAkAgoBy8UF/pEMmNx9YdlUdJNATh/Hg8u
	ED+K8VJTBRUbgGOL/VdVZOgvScTAtlRS
	=BQcm
X-Approved-For-Group: Fergus Henderson <fjh@cs.mu.oz.au> comp.std.c++
X-Original-Date: 30 Nov 01 03:16:53 GMT
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated
	iQBVAwUAPAeCH0HMCo9UcraBAQFb6gIAtDiMLEfXjMXPXt5At7Pr6ThvcF0pGj3c
	5LFpCl2vl9f9n9WS8+OpQ86msh8gB9g1ia5gZtS0fVu9j1+fTk9MRw==
	=ER4T
Xref: archiver1.google.com comp.lang.c++.moderated:31514 comp.std.c++:8379

Sungbom Kim <musiphil@bawi.org> writes:

> In the absence of an access specifier for a base class,
> - 'public' is assumed when the derived class is declared 'struct', and
> - 'private' is assumed when the derived class is declared 'class'.
> 
> I wonder what the rationale is for allowing the omission, and
> for giving such defaults if omission is allowed.

The defaults follow the ones inside the class. If a class is declared
with "class", the members are all private until the first access
specifier is seen. If it is declared using "struct", all members are
public by default. The base class is just some special kind of member,
so it gets the same treatment.

> Wouldn't there be any possibility that the next standard would
> declare the omission of the access specifier to be deprecated,
> as was the case with implicit int for function return types?

I guess there would, but I think it is unlikely to change. The reason
for deprecating the implicit int is that it is a frequent source of
confusion, as translations such as

(*x);

suddenly become well-formed. With the access specifiers for base
classes, I see no such problem: if a programmer is confused about it,
the compiler will usually report an error, instead of silently
mis-interpreting the program.

Regards,
Martin
---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]



