The Vector2 class


/*

The Vector2 class

*/

class Vector2
{

protected:
   double v[2];

public:
   Vector2( double v0, double v1 ){ v[0]=v0; v[1]=v1; }

   Vector2 operator+( Vector2 V2 )
      { return Vector2( v[0]+V2.v[0], v[1]+V2.v[1] ); }

   friend ostream &operator<<( ostream &, Vector2 );

};

// Some implementation details...

inline ostream &operator<<( ostream &s, Vector2 v1 )
{
   return s << '(' << v1.v[0] << ',' << v1.v[1] << ')';
}