Partager via


CObArray::ElementAt

Returns a temporary reference to the element pointer within the array.

CObject*& ElementAt(
   INT_PTR nIndex 
);

Parameters

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

Return Value

A reference to a CObject pointer.

Remarks

It is used to implement the left-side assignment operator for arrays. Note that this is an advanced function that should be used only to implement special array operators.

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

Class

Member Function

CByteArray

BYTE& ElementAt( INT_PTR nIndex );

CDWordArray

DWORD& ElementAt( INT_PTR nIndex );

CPtrArray

void*& ElementAt( INT_PTR nIndex );

CStringArray

CString& ElementAt( INT_PTR nIndex );

CUIntArray

UINT& ElementAt( INT_PTR nIndex );

CWordArray

WORD& ElementAt( INT_PTR nIndex );

Example

See the example for CObArray::GetSize.

Requirements

Header: afxcoll.h

See Also

Reference

CObArray Class

Hierarchy Chart

CObArray::operator [ ]

Other Resources

CObArray Members