CObArray::GetUpperBound
intGetUpperBound()const;
Return Value
The index of the upper bound (zero-based).
Remarks
Returns the current upper bound of this array. Because array indexes are zero-based, this function returns a value 1 less than GetSize.
The condition GetUpperBound( ) = –1 indicates that the array contains no elements.
The following table shows other member functions that are similar to CObArray::GetUpperBound.
Class | Member Function |
CByteArray | int GetUpperBound( ) const; |
CDWordArray | int GetUpperBound( ) const; |
CPtrArray | int GetUpperBound( ) const; |
CStringArray | int GetUpperBound( ) const; |
CUIntArray | int GetUpperBound( ) const; |
CWordArray | int GetUpperBound( ) const; |
Example
See CObList::CObList for a listing of the CAge
class used in all collection examples.
// example for CObArray::GetUpperBound
CObArray array;
array.Add( new CAge( 21 ) ); // Element 0
array.Add( new CAge( 40 ) ); // Element 1
ASSERT( array.GetUpperBound() == 1 ); // Largest index
CObArray Overview | Class Members | Hierarchy Chart
See Also CObArray::GetSize, CObArray::SetSize