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;
原文:https://www.cnblogs.com/lodger47/p/14877059.html