title: C++ Operator return difference
body: <p>Can anybody explain the difference (if there is any) between the 2 versions of this [] operator?
  Both version are working fine ... </p>
  
  <pre><code>class Test {
  
      int arr[100];
  
      int operator[](int i) {
          return arr[i];
      }
  
      int &amp; operator[](int i) {
          return arr[i];
      }
  };
  
  
  Test a;
  a.arr[5] = 10;
  
  // works for both versions:
  int n = a[5];
  </code></pre>