Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!vsi1!octopus!sjsumcs!horstman From: horstman@sjsumcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Re: Typedef inside of a class definition. Message-ID: <1990May9.032300.14501@sjsumcs.sjsu.edu> Date: 9 May 90 03:23:00 GMT References: <3748@elysium.sw.mcc.com> <26462BED.5865@paris.ics.uci.edu> Reply-To: horstman@sjsumcs.SJSU.EDU (Cay Horstmann) Organization: San Jose State University Lines: 31 In article <26462BED.5865@paris.ics.uci.edu> rfg@ics.uci.edu (Ronald Guilmette) writes: > >I really should let Michael answer this one but... > >The C++ language rules have changed recently with respect to the scope >of things declared within classes/structs/unions. > >It used to be that if you defined a type (via a typedef statement, or via >a struct, class, union, or enum type definition) within a class, that the >scope of the new typename was made "global". > >Nowadays, the scopes of such names are (or will soon be) restricted to >the class itself (and its member functions of course). > Fascinating feature... Does that mean that one can have private, protected and public typedefs, all of which live in the name space of the class, with type scope resolution operators when a public type is used outside member functions, like this? class X { public: typedef ... T; ... }; X::T a; Cay