隐式转换
Implicit conversion
short a=2000;
int b;
b=a;
class A {};
class B { public: B (A a) {} };
A a;
B b=a;
显式转换
Explicit conversion
short a=2000;
int b;
b = (int) a; // c-like cast notation
b = int (a); // functional notation
dynamic_cast <new_type> (expression) //合法才转,不合法为0 dynamic_cast<CDerived*>(pbb);
reinterpret_cast <new_type> (expression) //重新解释为别的类型 编译器,完全转换
static_cast <new_type> (expression) //有关联的继承树之间转换,不过不检查,编译期就做了
const_cast <new_type> (expression) //去掉const修饰 编译期
typeid(a).name()需要rtti