C++ 枚举类
1_枚举类.cpp
#include<iostream>
//枚举类是带有类类型特征的枚举类型
using namespace std;
enum class COLOR {RED,BLUE,GREEN};
//default: RED=0; BLUE=RED+1;...
class Book_bag{
public:
COLOR color; //0:red,1:blue,2:green
};
int main()
{
Book_bag b;
b.color = COLOR::RED;
}