const_cast:用来消除const, volatile, __unaligned属性的转换。 reinterpret_cast:用于空间的重新解释。 还有一个在VS2005中出现的类型转换关键字safe_cast.#2 static_cast: static_cast<type_id>(expression) 这个关键字可以用来将一个指针转换为父类的指针也可以转换为子类的指针或者基本的类型转换。但是这种转换是...
一、static_cast 对于类型转换,我们常常这么做: (type) expression 1. 引进了static_cast类型转换操作符后,我们只需这样做: static_cast<type>(expression) 1. 例如: intfirstNumber, secondNumber;doubleresult = ((double)firstNumber)/secondNumber;doubleresult =static_cast<double>(firstNumber)/secondNumber;...