自考新教材-p58_3(2)
源程序:
#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;
}
运行结果:

源程序:
#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;
}
运行结果:
