Mail Archives: djgpp/1997/09/03/17:37:14
Paul Derbyshire wrote:
> How do the enum elements BINARY and so forth become members of ios, as
> in
> ios::, and not of some enum? Normally the :: thing only applies to
> member
> functions and instance variables, not to enums. Is the enum actually
> inside the class? Can a class contain structs and subclasses actually
> inside itself so they are only defined in the scope of the class, for
> naming purposes?
Yes. In C++ if you have full scoping, so lexical elements can be
defined inside classes:
class C
{
public:
struct S { int i; };
enum E { e1, e2 };
};
Inside the scope of the class, you can refer to these things as S and E,
but outside you must refer to them as C::S and C::E (and the enum names
as E::e1 and E::e2).
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm://37.20.07n/121.53.38w
\
"War is like love; / it always finds a way."
/ Bertolt Brecht
- Raw text -