title: Double inheritance of enable_shared_from_this
body: <p>I have an object (Z) which derives from two other objects (A and B).</p>
  
  <p>A and B both derive from <code>enable_shared_from_this&lt;&gt;</code>, respectively <code>enable_shared_from_this&lt;A&gt;</code> and <code>enable_shared_from_this&lt;B&gt;</code>.</p>
  
  <p>Of course I call <code>shared_from_this()</code> on Z. And of course the compiler reports this as ambiguous.</p>
  
  <p>My questions are :</p>
  
  <ul>
  <li>is it safe to inherit twice from <code>enable_shared_from_this&lt;&gt;</code> or will it create two separated reference counts (bad !)</li>
  <li>If not safe, how do I solve this ?</li>
  </ul>
  
  <p>Note :
  I've found this other question <a href="https://stackoverflow.com/questions/12790859/bad-weak-pointer-when-base-and-derived-class-both-inherit-from-boostenable-sha">bad weak pointer when base and derived class both inherit from boost::enable_shared_from_this</a> but it doesn't really answer. Should I use the <code>virtual</code> trick too ?</p>