Newsgroups: comp.lang.c++ Path: utzoo!censor!geac!alias!rae From: rae@alias.UUCP (Reid Ellis) Subject: Re: Scope of return types Message-ID: Sender: Reid Ellis Reply-To: Reid Ellis Organization: Alias Research, Inc. Toronto ON Canada References: <1990Dec27.203259.9391@usenet@scion.CS.ORST.EDU> Distribution: comp Date: 3 Jan 91 07:37:18 GMT Glenn P. Parker and Thomas Keffer discuss the following: >> class A { >> public: >> enum Color {black, white}; >> static Color x; >> }; There was some question about how to define the static [class] variable 'x'. The proper way to do this is: > Color A::x = A::black; // C++ 2.0 does like this. A type can never be nested inside another type. Thus statements like the following are not legal: > A::Color A::x = A::black; // C++ 2.1 should like this (?) You can have anonymous types such as: struct { int a, b; void foo() { a++; } } var; Here the type of 'var' is undefined. You can say var.foo() and even reference var.a and var.b, but you can't assign it or anything else; it's a uniquely typed variable. Reid -- Reid Ellis 176 Brookbanks Drive, Toronto ON, M3A 2T5 Canada rae@gpu.utcs.toronto.edu || rae%alias@csri.toronto.edu CDA0610@applelink.apple.com || +1 416 446 1644