template
<typename T>
class Vector
{
private:
int size; // the number of elements in this Vector
T * buf; // the base of the array of Ts, you must allocate it
public:
Vector( int n ); // Vector v1(10); -- create a 10 element Vector
~Vector(); // destructor called automatically when a Vector dies
Vector( const Vector & v ) // Vector v2(v1);
T & operator [] ( const int i ); // T x = V[i];
T operator * ( const Vector & v ) const; // T x = V1 * V2
Vector operator + ( const Vector & v ) const; // V1 = V1 + V2;
const Vector & operator = ( const Vector & v ); // V1 = V2;
bool operator == ( const Vector & v ) const; if ( V1 == V2 )...
bool operator != ( const Vector & v ) const; // if ( V1 != V2 )...
friend Vector operator * ( const int n, const Vector & v );
// V1 = 20 * V2; -- each element of V1 will be element of V2 * 20
friend Vector operator + ( const int n, const Vector & v );
// V1 = 20 + V2; -- each element of V1 will be element of V2 + 20
friend ostream& operator << ( ostream & o, const Vector & v );
// cout << V2; -- prints the vector in format (v0, v1, v2,...,vn)
};