title: C++ Subclass Overloaded Multiplication Operator Hides Base Overloaded Dereference Operator
body: <p>Is it not possible to override both <code>operator*()</code> (unary dereference operator) and <code>operator*(double f)</code> (member binary multiplication with native <code>double</code> argument) at different levels of class heirarchy?</p>
  
  <p>Consider:</p>
  
  <pre><code>// base.h:
  template&lt;typename T&gt;
  class base {
    public:
      base(T v) : m_v(v) { }
      T&amp; operator*() { return m_v; }
      const T&amp; operator*() const { return m_v; }
    protected:
      T m_v;
  };
  </code></pre>
  
  <p>and</p>
  
  <pre><code>// special.h:
  #include "base.h"
  class super_double : public base&lt;double&gt; {
    public:
      super_double (double v) : base(v) { }
      const super_double operator* (double f) { return super_double (m_v * f); }
  };
  </code></pre>
  
  <p>I don't understand why the member binary <code>operator*</code> hides the dereference operator inherited from the base class, since their calling conventions are different.  The following code compiles fine if <code>super_double</code> doesn't define <code>operator*(double f)</code>, but emits an error if it does:</p>
  
  <pre><code>super_double q(289.3);
  double d = *q; // Only good if super_double doesn't define operator*(double f)
  </code></pre>
  
  <p>It's also fine if both forms of <code>operator*</code> are defined in the template base class instead.</p>
  
  <p>Why does the subclass' binary <code>operator*(double f)</code> hide the base class's unary <code>operator*()</code>?</p>