This const

Started by
1 comment, last by fastcall22 14 years, 4 months ago

Class newclass
{
     private:
             ....
      Public:
             void function() const;

};


What's the point of the const at the end of this function?
Advertisement
To tell the compiler that the method should be called on a const object -- i.e. the method shouldn't change any of the member variables.

This is known as a 'const method.'
[18.10] What is a "const member function"?

This topic is closed to new replies.

Advertisement