Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Type Names in Class Scope

Type names defined within class scope are considered local to their class. They cannot be used outside that class. The following example demonstrates this concept:

// type_names_in_class_scope.cpp
// C2146 expected
class Tree {
public:
   typedef Tree * PTREE;
   PTREE  Left;
   PTREE  Right;
   void  *vData;
};

PTREE pTree;  // not in class scope

Community Additions

ADD
Show:
© 2015 Microsoft