//Bounded vector declaration and definition
//
template <class Etype>
class BoundedVector : public Vector<Etype>
{
  public:
    // Constructor
    BoundedVector( int L, int H ) :
        Vector<Etype>( H - L + 1 ), Low ( L ) { }

    // Index the Array
    const Etype & operator[] ( int Index ) const;
    Etype & operator[] ( int Index );
  private:
    int Low;
};

template <class Etype>
Etype &
BoundedVector<Etype>::operator [ ] ( int Index )
{
    return Vector<Etype>::operator[ ] ( Index - Low );
}
    
template <class Etype>
const Etype &
BoundedVector<Etype>::operator [ ] ( int Index ) const
{
    return Vector<Etype>::operator[ ] ( Index - Low );
}
    

// Simple test program
main( )
{
    BoundedVector<double> V( 20, 39 );
    BoundedVector<double> W( 20, 39 );
    int i;


    for( i = 20; i < 40; i++)
        cout << V[ i ] << " ";
    cout << endl;
    for( i = 20; i < 40; i++ )
        V[ i ] = i;
    for( i = 20; i < 40; i++)
        cout << V[ i ] << " ";
    cout << endl;
    V.Double( );
    cout << V[50];
    cout << V[70];

    return 0;
}