title: Overloading square brackets while inheriting vector class in c++?
body: <p>i want to inherit a class called arithmeticVector from stl vector class. My problem is with square brackets overaloading. here is the code:</p>
  
  <pre><code>    template&lt;class type&gt;
  type&amp; ArithmeticVector&lt;type&gt;::operator[](int index) const{
  
      if(this-&gt;size()&lt;=index || index &lt; 0){
  
          throw string("Size Error!");
  
      }else{
  
          return vector&lt;type&gt;::operator[](index);
  
      }
  
  }
  </code></pre>
  
  <p>it gives error:</p>
  
  <p>Binding of reference to type <code>int</code> to a value of type <code>const int</code> drops qualifiers.</p>
  
  <p>in the line:</p>
  
  <pre><code>        return vector&lt;type&gt;::operator[](index);
  </code></pre>
  
  <p>how can i fix it?</p>