title: How to clone as weak pointer object in c++
body: <p>how to clone weak pointer??</p>
  
  <pre><code>class Distance
  
  {
  
  public:
  
      int height;
  };
  
  main() 
  {
  
      weak pointer &lt;Distance&gt; p;
      p-&gt;height = 12;
      weak pointer &lt;Distance&gt; a;
      a = p;
      a-&gt;height = 34;
  
  }
  </code></pre>
  
  <p>here when a->height is 10,then even p->height becomes 10.i don't want height of object p to chance.
  Can anyone tell how clone weak pointer?</p>