枚举的用法
类内定义
class Demo{
public:
enum COLORTYPE{RED,GREEN,BLUE,YELLOW,BLACK,WRITH};
}
// 在类外使用
cout<<Demo::RED<<endl;
类外定义
enum COLORTYPE{RED,GREEN,BLUE,YELLOW,BLACK,WRITH};
class Demo{
public:
}
// 在类外使用
cout<<COLORTYPE::RED<<endl;
浙公网安备 33010602011771号