C++类型转换

const_cast  去掉const属性,const int *p ; int *pp= const_cast<int*>p;

dynamic_cast  运行时多态可用,也就是有虚函数时可用,主要用于类层次之间的转换,下行转换有类型检查,上行转换和static_cast一样

static_cast   相关类型之间的转换常用

reinterpret_cast 不相关类型转换

posted on 2014-12-12 14:48  cxzhi  阅读(100)  评论(0)    收藏  举报

导航