Only variables may be volatile ; declaring them so indicates
that such variables might be modified asynchronously, so the compiler takes special precautions. --copied from sybex
它是和const相对应的一个关键字。
class tmp{
static int i ;
...
void change(tmp &t) const;
}
这样是不能改变在change()中改变i的值的。
class tmp{
volatile static int i ;
...
void change(tmp &t) const;
}
这样就可以了。
我不知道我说的是不是对的,呵呵。