title: C++ virtual base classes: parent's copy constructor doesn't get called
body: <p>I have three classes as you can see in the code below. Notice how I have written the copy constructors.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class Abstract
  {
  public:
      Abstract(){};
      Abstract( const Abstract&amp; other ): mA(other.mA){};
      virtual ~Abstract(){};
  
      void setA(double inA){mA = inA;};
      double getA(){return mA;};
  
      virtual void isAbstract() = 0;
  protected:
      double mA;
  };
  
  class Parent : public virtual Abstract
  {
  public:
      Parent(){};
      Parent( const Parent&amp; other ): Abstract(other){};
      virtual ~Parent(){};
  
  };
  
  
  class Child : public virtual Parent
  {
  public:
      Child(){};
      Child( const Child&amp; other ): Parent(other){};
      virtual ~Child(){};
  
      void isAbstract(){};
  };
  
  
  int main()
  {
      Child child1;
      child1.setA(5);
  
      Child childCopy(child1);
      std::cout &lt;&lt; childCopy.getA() &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>Now why <code>Abstract()</code> gets called instead of the copy constructor <code>Abstract( const Abstract&amp; other )</code> when <code>childCopy</code> is being constructed?</p>
  
  <p>Shouldn't <code>Child(other)</code> call <code>Parent(other)</code>? And shouldn't <code>Parent(other)</code> in turn call <code>Abstract(other)</code>?</p>