⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reinterpretcast.cpp

📁 C++高级编程这本书所附的源代码
💻 CPP
字号:
class X {};class Y {};int main(int argc, char** argv){  int i = 3;  X x;  Y y;  X* xp;  Y* yp;  // Need reinterpret cast to perform pointer conversion from unrelated classes  // static_cast doesn't work  xp = reinterpret_cast<X*>(yp);  // Need reinterpret_cast to go from pointer to int and from int to pointer  i = reinterpret_cast<int>(xp);  xp = reinterpret_cast<X*>(i);  // Need reinterpret cast to perform reference conversion from unrelated  // classes --  static_cast doesn't work  X& xr = x;  Y& yr = reinterpret_cast<Y&>(x);  return (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -