static_cast类似于一个函数或者宏,能返回原始值类型转换后对应的值,一段例程:
#include <iostream>
using namespace std;
///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
float x = 1.2f;
cout << static_cast<int>(x) << endl;
system("pause");
return 0;
}
///////////////////////////End Sub//////////////////////////////////
/************************************************************************/
/* output:
1
*/
/************************************************************************/
码农场