CObArray::GetAt

CObject* GetAt( int nIndex ) const;

Return Value

The CObject pointer element currently at this index.

Parameters

nIndex

An integer index that is greater than or equal to 0 and less than or equal to the value returned by GetUpperBound.

Remarks

Returns the array element at the specified index.

Note   Passing a negative value or a value greater than the value returned by GetUpperBound will result in a failed assertion.

The following table shows other member functions that are similar to CObArray::GetAt.

Class Member Function
CByteArray BYTE GetAt( int nIndex ) const;
CDWordArray DWORD GetAt( int nIndex ) const;
CPtrArray void* GetAt( int nIndex ) const;
CStringArray CString GetAt( int nIndex ) const;
CUIntArray UINT GetAt( int nIndex ) const;
CWordArray WORD GetAt( int nIndex ) const;

Example

See CObList::CObList for a listing of the CAge class used in all collection examples.

// example for CObArray::GetAt

CObArray array;

array.Add( new CAge( 21 ) ); // Element 0
array.Add( new CAge( 40 ) ); // Element 1
ASSERT( *(CAge*) array.GetAt( 0 ) == CAge( 21 ) );

CObArray OverviewClass MembersHierarchy Chart

See Also   CObArray::SetAt, CObArray::operator []