#include <iostream>

using namespace std;

class A
{
public:
    int x;
    void show()
    {
        cout << "A show() x = " << x << endl;
    }
};

class B
{
public:
    int x;
    void show()
    {
        cout << "B show() x = " << x << endl;
    }
};

int main()
{
    A *a = new A();
    a->x = 100;
    B *b = new B();
    b->x = 200;

    // B *b2 = static_cast<B *>(a); // error
    // B *b3 = dynamic_cast<B *>(a); // error
    B *b4 = reinterpret_cast<B *>(a); // 输出: B show() x = 100

    b4->show();

    return 0;
}
