c++ cZar
Saturday, December 5, 2009
Access non const member varible inside a const member function
class MyClass {
public:
void F() const {
const_cast
(this)->c = 10;
//c = 10;
}
private :
int c;
};
Other solution is mutable.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment