title: Multiple Inheritance Template Class
body: <pre><code>class messageA {
  };
  
  class messageB {
  };
  
  template&lt;class T&gt;
  class queue {
  public:
      virtual ~queue() {}
      void submit(T&amp; x) {}
  };
  
  class A : public queue&lt;messageA&gt;, public queue&lt;messageB&gt;
  {
  };
  
  int main()
  {
      A aa;
      aa.submit(messageA());
      aa.submit(messageB());
  }
  </code></pre>
  
  <p>My first thought is, the above code should be fine, as class A will contains 2 overloaded submit functions, which will accept messageA and messageB object.</p>
  
  <p>However, the compiler gives me the following error :</p>
  
  <p>May I know why there is an ambiguous? Isn't it is quite obvious that, for the 1st submit call, I want to call messageA version? For the 2nd submit call, I want to call messageB version?</p>
  
  <hr>
  
  <pre><code>------ Build started: Project: main, Configuration: Release Win32 ------
  Compiling...
  main.cpp
  .\main.cpp(21) : error C2385: ambiguous access of 'submit'
          could be the 'submit' in base 'queue&lt;messageA&gt;'
          or could be the 'submit' in base 'queue&lt;messageB&gt;'
  .\main.cpp(21) : error C3861: 'submit': identifier not found
  .\main.cpp(22) : error C2385: ambiguous access of 'submit'
          could be the 'submit' in base 'queue&lt;messageA&gt;'
          or could be the 'submit' in base 'queue&lt;messageB&gt;'
  .\main.cpp(22) : error C2664: 'queue&lt;T&gt;::submit' : cannot convert parameter 1 from 'messageB' to 'messageA &amp;'
          with
          [
              T=messageA
          ]
  .\main.cpp(22) : error C3861: 'submit': identifier not found
  </code></pre>