From -1003083230788534594 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,5f217f3ada88d5d8 X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 1994-09-08 19:22:06 PST Path: nntp.gmd.de!Germany.EU.net!EU.net!uunet!MathWorks.Com!europa.eng.gtefsd.com!emory!nntp.msstate.edu!olivea!koriel!male.EBay.Sun.COM!engnews1.Eng.Sun.COM!engnews2.Eng.Sun.COM!usenet From: clamage@Eng.Sun.COM (Steve Clamage) Newsgroups: comp.std.c++ Subject: Re: an extension idea that someone else mig Date: 6 Sep 1994 16:10:07 GMT Organization: Sun Microcomputer Corporation Lines: 54 Message-ID: <34i48v$8nv@engnews2.Eng.Sun.COM> References: <34ffs8$t1s@news.u.washington.edu> Reply-To: clamage@Eng.Sun.COM NNTP-Posting-Host: taumet.eng.sun.com In article t1s@news.u.washington.edu, ghogenso@u.washington.edu (Gordon Hogenson) writes: >rjl@f111.iassf.easams.com.au (Rohan LENARD) writes: > >>Additionally, the committee have gone out of their way to allow things to >>be split over multiple places. eg a namespace can be split into multiple >>parts just be defining it in different spots. >>eg. (from Bjarne's great book D&E of C++) > >> namespace Mine { >> void f(); >> }; > >> #include > >> namespace Mine { >> int g(); >> }; > >Are you saying that it is possible to have: > >foo.h: > > class Foo { > Foo(); > ~Foo(); > foofunction(); > }; > >foo.cc: > > namespace Foo { > Foo() { // ctor for Foo } > ~Foo() { //dtor code } > } > > //.... stuff > > namespace Foo { > foofunction() { code for this function } > }; > >Is this allowed? Every class defines a namespace, does it not? No. A class creates a scope, which is in effect a namespace, but a namespace is not a class. Splitting a class definition is not allowed. A namespace is purely a scope. A class is a type as well as a scope. --- Steve Clamage, stephen.clamage@eng.sun.com