I'm trying to construct a 2D vector class myself.
When I'm looking for sample code implemented by others, I found this:
class Vector2D {
 public:
  // components
  double x, y;
  Vector2D() : x( 0.0 ), y( 0.0 ) { }
  // returns reference to the specified component (0-based indexing: x, y)
  inline double& operator[] ( const int& index ) {
    return ( &x )[ index ];
  }
}
How is the [] operator overloaded? How do I understand (&x)[index]?
 
    