## Friday, June 24, 2005

### Scope of typedefs in a class in C++

I found this in the latest C++ draft specification

Type names obey exactly the same scope rules as other names.In particular, type names defined within a class definition cannot be used outside their class without qualification.

Example:
class X {public :   typedef int I;   class Y { /  . . .  / };   I a;};I b;            // errorY c;            // errorX::Y d;         // OKX::I e;         // OK