/*
* c++11关键字
* enum class
* 小鱼号的代码日志
*/
#include <QCoreApplication>
#include <iostream>
using namespace std;
enum EN_Color
{
Red,
Green = 20,
Blue
};
enum class NewColor :char
{
Red,
Green = 20,
Blue
};
enum class IsGood
{
Yes,
No
};
enum class IsHero
{
Yes,
No
};
enum class IsMom
{
Yes,
No
};
void show(IsGood,IsHero,IsMom)
{
}
void show2(bool isGood,bool isHero,bool isMom)
{
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
NewColor r = NewColor::Blue;
switch(r) {
case NewColor::Red:
cout << "red";
break;
case NewColor::Green:
cout << "green";
break;
case NewColor::Blue:
cout << "blue";
break;
default:
break;
}
int t = static_cast<int>(r);
EN_Color e = Blue;
int ee = e;
show2(true,false,false);
show(IsGood::Yes,IsHero::No,IsMom::No);
return a.exec();
}
网友评论