Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!saturn!daniel From: daniel@saturn.ucsc.edu (Daniel Edelson) Newsgroups: comp.lang.c++ Subject: Re: derivation from structs Message-ID: <7138@saturn.ucsc.edu> Date: 13 May 89 22:23:33 GMT References: <7103@saturn.ucsc.edu> <9353@alice.UUCP> Reply-To: daniel@saturn.ucsc.edu (Daniel Edelson) Organization: University of California, Santa Cruz Lines: 53 In article <9353@alice.UUCP> ark@alice.UUCP (Andrew Koenig) writes: >In article <7103@saturn.ucsc.edu>, daniel@saturn.ucsc.edu (Daniel Edelson) writes: >> Does derivation from structs rather than classes default >> to public rather than private? > >Saying > > struct X { /* stuff */ }; > >is precisely equivalent to saying > > class X { public: /* stuff */ }; > >and saying > > struct Y: X { /* stuff */ }; > >is precisely equivalent to saying > > class Y: public X { public: /* stuff */ }; > >Whether you said struct or class when defining X is invisible to >any class derived from X. > --Andrew Koenig, ark@europa.att.com So this means that given class X { /* stuff */ }; saying struct Y : X { /* more stuff */ }; is precisely equivalent to saying struct Y : public X { /* more stuff */ }; and given struct X { /* stuff */ }; saying class Y : X { /* stuff */ } is precisely equivalent to saying class Y : private X { /* stuff */ } Correct? daniel edelson daniel@saturn.ucsc.edu