Archive for 12月 15th, 2016

C++的4种类型转换

星期四, 12月 15th, 2016

摘自:http://www.cnblogs.com/welfare/articles/336091.html

一、C 风格(C-style)强制转型如下:

(T) expression // cast expression to be of type T
函数风格(Function-style)强制转型使用这样的语法:
T(expression) // cast expression to be of type T
这两种形式之间没有本质上的不同,它纯粹就是一个把括号放在哪的问题。我把这两种形式称为旧风格(old-style)的强制转型。

(更多…)