Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!oresoft!dan From: dan@oresoft.uu.net (Daniel Elbaum) Newsgroups: comp.lang.c++ Subject: Re: Are Class Decl.'s Legal in Funcs ? Message-ID: <667@oresoft.uu.net> Date: 4 Apr 89 19:39:11 GMT References: <890403-150348-4532@Xerox> <9418@claris.com> Reply-To: dan@oresoft.uu.net (Daniel Elbaum) Organization: Oregon Software, Portland, OR Lines: 20 In article <9418@claris.com> hearn@claris.com (Bob Hearn) writes: :From article <890403-150348-4532@Xerox>, by SJohnson.ElSegundo@XEROX.COM: :- Is the following code legal ? :- :- : :I don't know about classes nested in functions, but classes nested in :classes are legal - except they don't mean what you think they do. Their :scope is global. This is VERY ANNOYING. The one thing I hate most about :C is lack of nested scoping. Declarations nested in class definitions are not global, but are limited to the scope enclosing the class definition. Since class definitions are normally performed outside of any block, nested declarations tend to take on global scope. A declaration of a class in C++ is similar to a declaration of a struture in C. The template may be declared and used in any block, and the scope of the template definition is the block within which it is defined. The same is true for any data type. C certainly has nested scoping.