C语言使用强制类型转换(Type Cast)很简单,不管什么类型的转换,形式都如下: TYPE b = (TYPE)a; c++提供了4种类型转换操作符来应对不同场合的应用. const_cast static_cast dynamic_cast reinterpreter_cast 4种关键字的使用形式如下: TYPE b = static_cast(TYPE)(a) 1.const_cast 去掉类型的const或volatile属性 const SA ra ={1} ; //ra.i =…
we have four specific casting operators:dynamic_cast, reinterpret_cast, static_cast and const_cast. Their format is to follow the new type enclosed between angle-brackets (<>) and immediately after, the expression to be converted between parentheses…