![]() |
#2
yuyunliuhen2007-06-05 23:28
|
void main()
{
const int a=1;
int &b=const_cast<int&>(a);
cout<<a<<endl;
b=2;
cout<<&b<<":"<<*(&b)<<endl;
cout<<&a<<":"<<*(&a)<<endl;
}
输出:
1
0012FF28:2
0012FF28:1
为什么相同的地址里的取值会不同,到底const_cast有什么魔力?