摘要: 1.把一个 const 对象的地址赋给一个普通的、非 const 对象的指针也会导致编译时的错误:const double pi = 3.14;double *ptr = π // error: ptr is a plain pointerconst double *cptr = π /... 阅读全文
posted @ 2014-05-09 02:08 zzyoucan 阅读(170) 评论(0) 推荐(0) 编辑
摘要: const string &shorterString(const string &s1, const string &s2){return s1.size() < s2.size() ? s1 : s2;}inline const string &shorterString(const strin... 阅读全文
posted @ 2014-05-09 00:53 zzyoucan 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 这个是c++很基础的东西,等用到时又有点晕,翻开primer/*1.static不能声明成const和虚函数2.const static可以初始化,但还是需要在类外定义3.类的static必须定义,并且在类外定义,把内存分配在静态存储区,如果只声明不定义出现无法解析的外部命令我猜是他是在编译时期分配... 阅读全文
posted @ 2014-05-09 00:09 zzyoucan 阅读(193) 评论(0) 推荐(0) 编辑