+ 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

3rd Sep 2019, 5:13 PM
DÄRK PRÌÑÇÉ [ Inactive ]
DÄRK PRÌÑÇÉ [ Inactive ] - avatar
3 Respuestas
+ 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
3rd Sep 2019, 5:28 PM
ABADA S
ABADA S - avatar
+ 3
welcome
3rd Sep 2019, 11:50 PM
ABADA S
ABADA S - avatar
+ 2
Thank you
3rd Sep 2019, 5:31 PM
DÄRK PRÌÑÇÉ [ Inactive ]
DÄRK PRÌÑÇÉ [ Inactive ] - avatar