If I declare an instance variable as volatile, will the object of this class be volatile?
Like:
class A
{
volatile int i;
};
A a;
My question is that will the entire a become cv开发者_StackOverflow qualified? May be a naive question.
No, all of a
will not be volatile
. Just as you can have fields of a class that are const
without every instance of the class being const
, you can have volatile
fields that do not make the entire class instance volatile
.
精彩评论