源程序:
#include <iostream>using namespace std;int main(){ const int x = 5, y = 6; const int *p = &x; p = const_cast<int *>(&y); cout << *p << endl; system("pause"); return 1;}
运行结果: