class SomeClass{
private:
int* p;
public:
SomeClass() {p = new int();}
void foo() const {*p = 20;}
};
//...
const SomeClass obj;
obj.foo();
Let's say I consider the pointed-to object as part of the constness of the class. Do I have any way to make sure it's not modified in const functions (apart from not forgetting about it)? (No, I don't mean making it const int*
)