title: error: type ‘class’ is not a direct base of ‘class’
body: <p>I haven't been able to find an answer that relates specifically to my question. It's a bit of a "strange" case in terms of what I've seen. </p>
  
  <p>So I have a class <code>Child2</code> that inherits from <code>Child1</code> that in turn inherits from the <code>Parent</code>. The <code>Parent</code> doesn't have a constructor.</p>
  
  <p>Here is how I inherit:</p>
  
  <p><strong>Child1.h:</strong></p>
  
  <pre><code>class Child1 : virtual public Parent
  </code></pre>
  
  <p>This is the function that I want to call from <code>Child2</code>'s constructor:</p>
  
  <pre><code>void Child1::foo(unsigned int i)
  {
      // ...
  }
  </code></pre>
  
  <p><strong>Child2</strong></p>
  
  <pre><code>Child2::Child2() : Child1()
  {
     foo(10);
  }
  </code></pre>
  
  <p>There are no functions called <code>foo()</code> in <code>Child2</code> so there shouldn't be any ambiguity if I understand correctly.</p>
  
  <p>However, I encounter this error:</p>
  
  <blockquote>
    <p>Child2.cpp: In constructor ‘Child2::Child2()’:
     Child2.cpp:12:28: error: type ‘Child1’ is not a direct base of ‘Child2’
     Child2::Child2() : Child1()</p>
  </blockquote>
  
  <p><code>Child1</code>'s constructor is working, so I've left it out. I'm not certain if it is important in this case.</p>