摘要:
TestCxxSyntax.h//
// TestCxxSyntax.h
// DreamStack
//
// Created by Bruce Yang on 12-12-31.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
// #ifndef DreamStack_TestCxxSyntax_h
#define DreamStack_TestCxxSyntax_h /** * Added by Bruce Yang on 2012.12.31.00.33~ * 熟练运用 const 能够大大... 阅读全文
posted @ 2012-12-31 00:58
程序流程图
阅读(240)
评论(0)
推荐(0)
摘要:
转载自:http://blog.csdn.net/eric_jo/article/details/4138548 C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根据各方面查到的资料进行总结如下,期望对朋友们有所帮助。Const是C++中常用的类型修饰符,常类型是指使用类型修饰符const说明的类型,常类型的变量或对象的值是不能被更新的。一、Const作用如下表所示:No.作用说明参考代码1可以定义const常量 const int Max = 100;2便于进行类型检查 const常量有数据类型,而宏常量没有数据类型。编译器可以对前者进行类型安全检查,. 阅读全文
posted @ 2012-12-31 00:52
程序流程图
阅读(189)
评论(0)
推荐(0)
摘要:
转载自:http://zhidao.baidu.com/question/55437904.htmlclass a{public:int x(){......}int x() const{......}};这样的 const 重载是允许的 但是什么时候会调用 x()什么时候会调用 x() const ? 他们又有什么不同呢?const a a1;a a2;a1.x();a2.x();a1调用const版本,a2调用非const版本。后面加const表示在该函数中不能对类的数据成员进行改变,比如:class A{private:int aa;public:int x(){return aa++; 阅读全文
posted @ 2012-12-31 00:36
程序流程图
阅读(203)
评论(0)
推荐(0)

浙公网安备 33010602011771号