关键字mutable是C++中一个不常用的关键字,他只能用于类的非静态和非常量数据成员我们知道一个对象的状态由该对象的非静态数据成员决定,所以随着数据成员的改变,对像的状态也会随之发生变化! 如果一个类的成员函数被声明为const类型,表示该函数不会改变对象的状态,也就是该函数不会修改类的非静态数据 Read More
posted @ 2014-05-23 03:51
findumars
Views(705)
Comments(0)
Diggs(0)
volatile关键字 volatile关键字是一种类型修饰符,用它声明的类型变量表示可以被某些编译器未知的因素更改,比如:操作系统、硬件或者其它线程等。遇到这个关键字声明的变量,编译器对访问该变量的代码就不再进行优化,从而可以提供对特殊地址的稳定访问。使用该关键字的例子如下: int volati Read More
posted @ 2014-05-23 03:44
findumars
Views(498)
Comments(0)
Diggs(0)
记下以后所有碰到使用数组名称时候的是是非非:int main(int argc, char* argv[]){ char x[3]="abc"; // 编译错误 char a[3]={'a','b','c'}; char b[3]; b=a; // 常指针不能赋值 re... Read More
posted @ 2014-05-23 03:37
findumars
Views(383)
Comments(0)
Diggs(0)
会记下所有C++类型转换的例子在这里:#include "stdafx.h"#include using namespace std;int main(int argc, char* argv[]){ cout<< 22/5*3 <<endl; // 输出12,注意连进位都没有包括 re... Read More
posted @ 2014-05-23 03:29
findumars
Views(316)
Comments(0)
Diggs(0)
以下三种情况皆错,都编译不过:int main(int argc, char* argv[]){ int a; int b[a];}int main(int argc, char* argv[]){ int a=4; int b[a];}int main(int argc, ... Read More
posted @ 2014-05-23 03:27
findumars
Views(529)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号