title: C++ - Make pointed-to object part of object constness
body: <pre><code>class SomeClass{
  
  private:
      int* p;
  
  public:
      SomeClass() {p = new int();}
  
      void foo() const {*p = 20;}
  
  };
  
  //...
  
  const SomeClass obj;
  obj.foo();
  </code></pre>
  
  <p>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 <code>const int*</code>)</p>