类型在类范围内定义的名称视为本地到它们的类。它们不能是使用的外部类别。下面的示例演示了此概念:
// 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
类型在类范围内定义的名称视为本地到它们的类。它们不能是使用的外部类别。下面的示例演示了此概念:
// 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