c++ typeid对多种类型名称的输出

来源:互联网 发布:drcom校园网客户端mac 编辑:程序博客网 时间:2024/05/17 00:13

include

using namespace std;
class B
{
public:
B() = default;
B(int b) :a(b) {};
private:
int a;
};
enum class color { red = 1, yellow = 5, green = 9 };
int main()
{
int a = 42;
string b = “555”;
double c = 5.4444;
float q = 5.33;
B e();
color r = color::red;
cout << typeid(a).name() << endl
<< typeid(b).name() << endl
<< typeid(c).name() << endl
<< typeid(e).name() << endl
<< typeid(r).name() << endl
<< typeid(q).name() << endl;
system(“pause”);
return 0;
}
这里写图片描述

0 0
原创粉丝点击