By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

const member functions

P: n/a
I've been having trouble with my news reader. Sorry if I posted this
twice...

Hi. I heard once that there is a way to allow a const member function to
alter the value of a member if the member is declared in some way. Can
someone tell me how to do that, or is this impossible?

For example:

class foo
{
specialdeclaration int index;
void bar() const
{
index = 0; \\ ok because index has been declared in a special way.
}
};

thanks,
denver.

Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Denver Dash wrote:
I've been having trouble with my news reader. Sorry if I posted this
twice...

Hi. I heard once that there is a way to allow a const member function
to
alter the value of a member if the member is declared in some way.
Can someone tell me how to do that, or is this impossible?

For example:

class foo
{
specialdeclaration int index;
Replace 'specialdeclaration' with 'mutable'.
void bar() const
{
index = 0; \\ ok because index has been declared in a special
way.
}
};


Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.