Answers for "can const int change c++"

C++
0

update variable in const function C++

//declare x mutable
class A (){
   mutable int x;
public:
   void func () const {
      //change value of x here
   }
};
Posted by: Guest on August-03-2021

Browse Popular Code Answers by Language