Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwvax!tank!eecae!shadooby!sharkey!mcf!mibte!gamma!thumper!ulysses!andante!alice!shopiro From: shopiro@alice.UUCP (Jonathan Shopiro) Newsgroups: comp.lang.c++ Subject: Re: Any interest in making C++ a real superset of ANSI C? Summary: class and struct are identical except for publicity Message-ID: <9408@alice.UUCP> Date: 30 May 89 02:40:23 GMT References: <26575@watmath.waterloo.edu> <10213@claris.com> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 27 In article <10213@claris.com>, kevin@claris.com (Kevin Watts) writes: > Walter Bright's suggestion (struct as in C, class as in C++) seems like a > reasonable compromise. It brings up a question: is there any penalty for > using class where struct would do? In C++, class and struct are identical, except that base classes and members of structs are public by default, and base classes and members of classes are private by default. In both cases the default can be overridden with the ``public'' and ``private'' (and ``protected'' for members) keywords. These choices have no runtime performance consequences whatsoever. In my opinion, this distinction between class and struct is easy to understand and use. I think the kinds of changes that have been suggested might make it easier to port code from C to C++, but they would make C++ itself harder to understand and use. Note: in the latest version of C++, a warning is generated if the base class of a class is private by default. Use the ``private'' keyword explicitly and the warning goes away. -- Jonathan Shopiro AT&T Bell Laboratories, Warren, NJ 07060-0908 research!shopiro (201) 580-4229