|
-
September 1st, 2009, 03:20 PM
#1
Question about CV-Qualifiers for class members
Hello,
I'm looking for the location in the C++03 standard that discusses the rules for const qualification of members when a class object is const-qualified. For example, if I have a class like this:
Code:
class Fubar
{
int* m_myInt;
char*** m_myComplexPtr;
};
And I create a variable like this:
How are the members m_myInt and m_myComplexPtr const-qualified? For example, is it like this:
Code:
int const* const m_myInt;
char const* const* const* const m_myComplexPtr;
Or is it:
Code:
int* const m_myInt;
char*** const m_myComplexPtr;
I'm not really sure of the detailed language rules for this stuff. For pointers, you would think that technically the pointer would be made const, and not the data it points to, since the pointer is owned by the class (and thus must be guaranteed to be immutable), but the data being pointed to is not owned by the class, it is owned by the pointer. I guess constness is transitive this way?
--MrDoomMaster
--C++ Game Programmer
Don't forget to rate me if I was helpful!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|