#include<iostream>
#include <string>
#include <conio.h>
using namespace std;
enum class color{ yellow = 12, blue, red, green };
enum class color_1{ yellow , blue = 5, red, green, huangse, hahah,akjdhf,ahkfjhaskjui,sj };//枚举类,就和普通类相似,
enum class color_2: unsigned short{ yellow , blue = 46, red, green }; // 用于区分相同的枚举成员
enum color_3 { yellow = 12, blue, red, green , adlkfa};
//enum class color_4: string{ yellow , blue, red, green };//枚举的底层类型必须是整型
int main(void)
{
cout << sizeof(color) << endl; //长度为4
cout << sizeof(color_1) << endl; //长度为4 估计是指针是32位 占4个字节
cout << sizeof(color_3) << endl; //长度为4
int a = 12;
if(a == yellow)cout << "color_3的yellow" << endl;
color_1 t = color_1::red;
int b = (int)t; // 类型强制转换一下 不然会报错的
cout << b << endl;
int x = (int)color::yellow;
cout << x << endl;
int y = (int)color_2::red ;
cout << y << endl;
system("pause");
return 0;
}