摘要:
初看C++ primer,const关键字的内容林林总总,记录一下。1. 定义const对象:把一个对象定义为常量const int bufSize=512;bufSize=0;//错误2. 被const修饰的对象默认为文件的局部变量:只能在定义该对象的文件中使用,其他文件不可访问。除非显示的指定此const对象为extern。//file_1.ccextern const int bufSize=fcn();//file_2.ccextern const int bufSize;//使用file_1里的bufSize3. const引用:指向const对象的引用,即对于const对象,其引用 阅读全文
posted @ 2012-02-24 10:46
月神夜
阅读(195)
评论(0)
推荐(0)
浙公网安备 33010602011771号