摘要: #include<iostream> using namespace std; int main() { const int max=100; const int min=-100; //C++语言强制要求指向const对象的指针也必须具有const特性 //指向const对象的指针 //虽然指向的是const的值,但是指针本身并不是const的,所以指针仍然可以改变其值(地址值),指针所指向的对象则不可以改变 const int * ptr=&max; ptr=&min;// it is ok //*ptr=10; it is wrong,指向的是const值,所 阅读全文
posted @ 2011-02-23 09:35 糖拌咸鱼 阅读(250) 评论(1) 推荐(0) 编辑