定数変数の値はポインタートリックを通じて変更できますが、次のようなことは可能ですか?
class A (){
int x;
public:
void func () const {
//change value of x here
}
}
ベストアンサー1
宣言するx
mutable
class A (){
mutable int x;
public:
void func () const {
//change value of x here
}
};