[置顶] reinterpret_cast,const_cast,static_cast,dynamic_cast 总结
摘要:
#include<iostream.h>int main(void){//reinterpret_cast//将一个类型指针转换为另一个类型指针,这种在转换不修改指针变量值数据存放格式//只需在编译时重新解释指针的类型,他可以将指针转化为一个整型数但不能用于非指针的转换double d=9.3;double* pd = &d;int* pi = reinterpret_cast<int *> (pd);class A{};class B{};A* pa = new A;B* pb=reinterpret_cast<B*>(pa); //将pa 转为B 阅读全文
posted @ 2012-04-04 16:59 linzuxin 阅读(155) 评论(0) 推荐(0)