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