Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have no compiler right now, but I guess one inheritance could hide the other : The compiler will use <a href="http://en.wikipedia.org/wiki/Argument_dependent_name_lookup" rel="noreferrer">Koenig Lookup</a> to find the right symbol, and if I remember correctly, once the compiler find a suitable symbol (i.e., a method called "submit"), it will stop searching for others in parent and/or outer scopes.</p> <p>In this case, I thought both inheriting classes would be searched for the symbol, but without your exact compiler (Visual C++ 2003 ? 2008 ? 2010 ?), I cannot guess much more.</p> <p>After some thoughts, another possibility is that the compiler did find both symbols, but is unable to decide which to call (at that moment of symbol resolution, the compiler cares only for symbol name, not its exact prototype). I believe this last explanation to be the right one.</p> <p>Try adding using statements in your derived classes :</p> <pre><code>class A : public queue&lt;messageA&gt;, public queue&lt;messageB&gt; { using queue&lt;messageA&gt;::submit ; using queue&lt;messageB&gt;::submit ; } ; </code></pre> <p>to bring both the submit methods directly in the A class scope.</p> <p>Note, too, that your submit methods are taking messages as non-const reference, while in the constructor, your message parameters are temporaries (and thus, const r-values).</p> <p>Re-writting the main as:</p> <pre><code>int main() { A aa; messageA mA ; messageA mB ; aa.submit(mA); aa.submit(mB); } </code></pre> <p>could help compile (this could explain the compiler error on line 22).</p> <p>Or you could change the prototype of your submit methods to accept const references instead of non-const references.</p> <p>Note: Still without compiler, so trying to brain-debug your code... :-P ...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload