共用方式為


CArray::GetAt

TYPEGetAt(intnIndex**)const;**

Return Value

The array element currently at this index.

Parameters

TYPE

Template parameter specifying the type of the array elements.

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.

Example

CArray<CPoint,CPoint> myArray;
CPoint pt;

// Add elements to the array.
for (int i=0;i < 10;i++)
   myArray.Add( CPoint(i, 2*i) );

// Modify all the points in the array.
for (i=0;i <= myArray.GetUpperBound();i++)
{
   pt = myArray.GetAt(i);
   pt.x = 0;
   myArray.SetAt(i, pt);
}

CArray OverviewClass MembersHierarchy Chart

See Also   CArray::SetAt, CArray::operator [], ConstructElements