正在加载图片...
静态查找表(ADT) 部分操作的实现: template <class Type> const Type vector< Type>: operator [( int index)const i Exception( index≤0‖ index> Arraysize,“ Out of boundary!”); return Arraylindex template <class Tvpe> const Vector< Type>& Vector< Type>:: operator =( const Vector< Type> R )i if( this I=&R)( Exception( arraySize I=R ArraySize, " Size is not same!); forint k=1; k <= ArraySize,, k++) Arraylk]=r. arraylk] return *this静态查找表(ADT) • 部分操作的实现: template <class Type> const Type & Vector<Type> :: operator [ ] ( int index ) const { Exception( index ≤0 || index > ArraySize, “Out of boundary!”); return Array[index]; } template <class Type> const Vector<Type> & Vector<Type> :: operator = ( const Vector<Type> R ){ if ( this != &R ) { Exception( ArraySize != R.ArraySize, “Size is not same!”); for(int k = 1; k <= ArraySize; k++ ) Array[k] = R.Array[k]; } return *this; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有