title: C++ interface class causes ambiguous function call (Qt)
body: <p>This may be due to me not entirely understanding how interfaces in C++ work, but here we go:</p>
  
  <p>I have base interface for a property class in QT5.</p>
  
  <pre><code>class IBaseProperty
  {
  public:
      virtual ~IBaseProperty() {}
  
      // Returns the property key as a string.
      virtual QString     getKey() = 0;
  
      // Returns the property value as a raw string.
      virtual QString     getValueRaw() = 0;
  
      // Sets the property key as a string.
      virtual void        setKey(QString key) = 0;
  
      // Sets the property value as a raw string.
      virtual void        setValueRaw(QString value) = 0;
  };
  </code></pre>
  
  <p>I also have a templated interface extension to make it easier to subclass properties that handle more specific data types.</p>
  
  <pre><code>template &lt;class T&gt;
  class IProperty : public IBaseProperty
  {
  public:
      virtual ~IProperty() {}
  
      // Classifies a property with a Property_t identifier.
      virtual Property_t  getPropertyType() = 0;
  
      // Returns the property value as the specified type.
      // Bool is true if conversion was successful.
      virtual T           getValue(bool* success) = 0;
  
      // Sets the property value as the specified type.
      virtual void        setValue(T value) = 0;
  
      // Returns whether the current value can be converted correctly
      // to the specified type.
      virtual bool        canConvert() = 0;
  };
  </code></pre>
  
  <p>My base property (implementing only IBaseProperty) looks like this:</p>
  
  <pre><code>class BaseProperty : public QObject, public IBaseProperty
  {
      Q_OBJECT
  public:
      explicit BaseProperty(QObject *parent = 0, QString key = "", QString value = "");
  
      virtual QString getKey();
      virtual QString getValueRaw();
  
  public slots:
      virtual void setKey(QString key);
      virtual void setValueRaw(QString value);
  
  protected:
      QPair&lt;QString, QString&gt; m_Property; // KV pair this property holds.
  };
  </code></pre>
  
  <p>I subclass this to make a string property - obviously the base property can just return strings, but I wanted to keep the same function format between string/int/float/etc. properties by allowing getValue in all of them. GetValue in this case simply calls getValueRaw to return the value.</p>
  
  <pre><code>class StringProperty : public BaseProperty, public IProperty&lt;QString&gt;
  {
      Q_OBJECT
  public:
      explicit StringProperty(QObject *parent = 0, QString key = "", QString value = "");
  
      virtual inline Property_t getPropertyType() { return Prop_String; }
  
      virtual QString     getValue(bool* success);
      virtual bool        canConvert();
  
  public slots:
      virtual void        setValue(QString value);
  };
  </code></pre>
  
  <p>The ambiguity occurs when I implement getValue and setValue:</p>
  
  <pre><code>inline QString StringProperty::getValue(bool* success)
  {
      *success = canConvert();
      return getValueRaw();      // This line causes the ambiguity.
  }
  </code></pre>
  
  <p>The compiler complains:</p>
  
  <blockquote>
    <p>C2385: Ambiguous access of 'getValueRaw': could be the 'getValueRaw'
    in base 'BaseProperty' or could be the 'getValueRaw' in base
    'IBaseProperty'.</p>
  </blockquote>
  
  <p>I'm not entirely sure what to do in this situation - I would have thought that IBaseProperty being a pure virtual class would mean that the function would not be able to be called from this point anyway, so would only be called from where it was implemented (BaseProperty). What would be the correct course of action to take to fix this? I'm not sure from which base class I should be calling the function.</p>