modifiers and classes question

Started by
1 comment, last by Korndog 23 years, 12 months ago
Hi, I have a question that I can''t seem to find in my C++ books. Say I have a class A, and in class A there''s a class B. class B has a couple of ints and chars and whatnot. If I declare an instance of class A volatile, does that make everything inside of its class B volatile, or will I have to specify that again? Sorry if that was confusing, heh...
Advertisement
It should render the variables in B volatile too. It''s much the same way that if you declare a const instance of a class it''s members are const as well. Of course that only applies if you access it through the volatile pointer to A.
Do you mean:


class A
{
public:
class B { ... };
};



or:


class A
{
public:
B m_B;
};



In the first instance, it wouldn''t affect the way you can use any object of class B, and in the second instance it would affect it, like SiCrane said.



- null_pointer
Sabre Multimedia

This topic is closed to new replies.

Advertisement