/* 类型强制转换后 本身类型不变 */ #include "stdafx.h" #include <iostream> #include <thread> #include <ctime> #include <Windows.h> #include <typeinfo> using namespace std; int main() { int* p1 = new int; void* p2; cout << "The type of p1 is " << typeid(p1).name() << endl; cout << "The type of p2 is " << typeid(p2).name() << endl; double* p3 = (double*)p1; cout << "The type of p3 is " << typeid(p3).name() << endl; int a = 1; double b = (int)a; cout << "The type of a is " << typeid(a).name() << endl; cout << "The type of b is " << typeid(b).name() << endl; cout << "The type of a is " << typeid(a).name() << endl; }
类型转换
猜你喜欢
转载自blog.csdn.net/a673786103/article/details/80039096
今日推荐
周排行