+ 1
Can we change const object's variables by first making a pointer to it and then using the selection operator -> ??
Class const Object variable
3 odpowiedzi
+ 5
in C we was pointing to a const variable by a non-const pointer and change its value
in C++ we can't do that
if you want to change a member of a const object , define it as mutable
for example
mutable int x;
this will make it changeable even in const object
+ 3
welcome
+ 2
Thank you