View Single Post
Old 05-02-2005, 03:56 AM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
It means that the function function() is not allowed to modify any members.
Code:
class ConstTest
{
public:
   string a_;
   void print() const
   {
      a_ =  "Hi Iostromos!"; //ILLEGAL. const qualifier forbids modifying members.
      std::cout<<"a_"<<std::endl;
   }
};
__________________
Valmont is offline   Reply With Quote