title: Solve diamond problem without virtual inheritance
body: <p>Here's the situation:</p>
  
  <pre><code>class A
  {
  public:
    A();
    void actionA();
  private:
    int a;
  };
  
  class B1
    : public A
  {
    ...
  };
  
  class B2
    : public A
  {
    ...
  };
  
  class OrthogonalFeature
    : public A
  {
    void orthogonalFeature();
  };
  
  class C1
    : public B1
    , public OrthogonalFeature
  {
      ...
  };
  
  class C2
    : public B2
    , public OrthogonalFeature
  {
      ...
  };
  
  class User
  {
  public:
    void run() {
      c.actionA();
      c.orthogonalFeature();
    }
  private:
    MyNeededType c; // c is either C1 or C2
  };
  </code></pre>
  
  <p>The <code>User</code> class needs to own an object that can perform <code>actionA()</code> and <code>actionB()</code>.</p>
  
  <p>Therefore, I might want to create class <code>MyNeededType</code>, which needs to inherit from <code>A</code> and (<code>B1</code> or <code>B2</code>), and I get a diamond problem (the data member <code>a</code> is ambiguous). The usual way to solve this is to use virtual inheritance. However, for this project, I CANNOT use virtual inheritance, for performance reason (please just accept this at face value).</p>
  
  <p>So I have a problem. What might help is that the <code>User</code> class will operate only on 2 existing classes that I have: <code>C1</code> and <code>C2</code>. So the other option I thought of was to make <code>C1</code> and <code>C2</code> inherit from <code>A</code>, and reimplement <code>orthogonalFeature</code> inside these derived classes, instead of inheriting <code>OrthogonalFeature</code>. Therefore no diamond. Here's how that would look:</p>
  
  <pre><code>class C1
    : public B1
  {
     public:
       void orthogonalFeature();
  };
  
  class C2
    : public B2
  {
      void orthogonalFeature();
  };
  </code></pre>
  
  <p>I like that solution, but how can I then specify the type of <code>c</code> in <code>User</code> ? It feels to me that I need to create a type, that means: this class is <code>C1</code> or <code>C2</code>. But I am not aware that this exists in c++?</p>
  
  <p>Any idea welcome, thanks!</p>