title: How can I solve removing object that is shared among others
body: <p>I have this scenario:</p>
  
  <pre><code>struct B 
  { 
     A * ptr; 
  }
  
  A * a1 = new A1;
  
  b1.ptr = a1
  b2.ptr = a1
  b3.ptr = a2
  </code></pre>
  
  <p>Now I <code>delete a1</code> at some different place, but there are no information about <code>b</code> objects.  How can I automatically set:</p>
  
  <pre><code>b1.ptr = null 
  b2.ptr = null
  </code></pre>
  
  <p>Or how is this mechanism called, so I can "google" some more info.</p>