1、enum 枚举类型
enum string {
x1, //0 //全局宏常量
x2, //1
x3 = 10, //10
x4, //11
x5, //12
} x; //0 //全局变量
int main()
{
cout << x << endl;
cout << x1 << endl;
cout << x2 << endl;
cout << x3 << endl;
cout << x4 << endl;
cout << x5 << endl;
return 0;
}
2、namespace 命名空间
namespace color {
int red;
int blue;
};
namespace { //匿名命名空间
int x; //相当于 static int x;
int y;
};
int main()
{
cout << color::red << endl;
cout << color::blue << endl;
cout << ::x << endl;
cout << y << endl;
return 0;
}