最不安全,最鸡肋 不推荐

class Base {};
class Child :public Base {};
class Other {};
//重新解释转换(reinterpre_cast)
void test02()
{
    int a = 10;
    int* p = reinterpret_cast<int*>(a);

    Base* base = NULL;
    Other* other = reinterpret_cast<Other*>(base);  //两个没有任何关系的类都能转换
                                                     //最不安全 不推荐
   
}

 

相关文章:

  • 2021-12-28
  • 2021-08-27
  • 2021-12-04
  • 2021-12-05
  • 2021-12-05
  • 2021-07-12
猜你喜欢
  • 2021-10-02
  • 2021-11-25
  • 2021-07-17
  • 2021-10-21
  • 2021-05-06
  • 2022-12-23
相关资源
相似解决方案