Calling a virtual function from overloaded subscript operator
<p>I am trying to overload the subscript operator ([]) on an abstract class, the function called by the overload is implemented in the concrete object.</p>

<pre><code>class CollectionBase {
public:
    double&amp; operator[] (const int nIndex)
    {
        return getValue(nIndex);
    }

    virtual double getValue(int index) = 0;
};

class Collection    : public CollectionBase
{
    double getValue(int index) { return 0; }
};
</code></pre>

<p>The problem I am having is that my compiler is throwing an error on the call to getValue in the overload.</p>

<blockquote>
  <p>Initial value of reference to non-const must be an lvalue</p>
</blockquote>

<p>Does anybody know the syntax for what I am trying to do?</p>
