Monday, June 27, 2011

"Mutable" Key Word

mutable allows a class data member to be modified in a const function.
Example:
Class A{
   private:
      mutable int x;

   public:
      void foo(int a) const
      {
         x = a;
      }   
}

No comments:

Post a Comment