I apologize if the title sounds abstruse, let me make that simple with an example :
class A
{
public:
A(int *flag) : flag_(flag) {}
void foo();
private:
void bar();
int *flag_;
};
The question is: can I prevent this class from changing the value pointed to by flag_?
Note : I'm thinking, maybe I want to write something like const int * flag_
, but I do not want to make the value pointed to by flag
"irrevocably" constant. In my case, this value is the value of some member variable of some other class, which can be changed.
Thanks for your insights!