title: Overriding Qualified Virtual Methods
body: <p>I have C++ class with multiple parents; each parent defines a function with a common name but a different purpose:</p>
  <pre><code>class BaseA
  {
      virtual void myFunc();  // does some task
  };
  class BaseB
  {
      virtual void myFunc();  // does some other task
  };
  class Derived : public BaseA, public BaseB;
  </code></pre>
  <p>If that was it, I would have no problem - I could resolve the ambiguity it with a <strong>using</strong> statement, and I could choose which one to call using the base class names and the scope resolution operator.</p>
  <p>Unfortunately, the derived class needs to override them both:</p>
  <pre><code>class Derived : public BaseA, public BaseB
  {
      virtual void BaseA::myFunc(); // Derived needs to change the way both tasks are done
      virtual void BaseB::myFunc();
  }
  </code></pre>
  <p>This doesn't work, not because it introduces a new ambiguity (although it may), but because</p>
  <blockquote>
  <p>&quot;error C3240: 'myFunc' : must be a non-overloaded abstract member function of 'BaseA'&quot;</p>
  <p>&quot;error C2838: illegal qualified name in member declaration&quot;</p>
  </blockquote>
  <p>Under different circumstances I might just rename the methods, or make them pure virtual as the compiler suggests.  However, the class hierarchy structure and a number of external issues make the first option <strong>extremely</strong> difficult, and the second impossible.</p>
  <p>Does anyone have a suggestion?  Why are qualifiers only allowed for pure virtual methods?  Is there any way to simultaneously override virtual methods and resolve ambiguities?</p>