2012年8月25日

摘要: const使用总结 const修饰变量,表示该变量为常量,必须在定义是初始化,且不能修改它的值。const修饰指针:const int *ip = &val:ip是指向const对象(int)的指针,即不能通过(*ip)修改val的值(如果val不是const常量,可以通过其他方式修改val的值);int *const ip = &val:ip是指向int对象的const指针,即不能修改ip的值,但(*ip)的值可以修改;const int *const ip=&val:ip是指向const对象的const指针。Const修饰函数:const int& op(c 阅读全文
posted @ 2012-08-25 19:33 stronger 阅读(399) 评论(1) 推荐(0) 编辑

导航