GetAt
Provides access to an element in the array
_TemplType GetAt( int nIndex )const
Returns a reference to the object at the requested index
EX1
#include <Array.h> struct PERSON { int nID; }; void Array_GetAt_ex1() { Array<PERSON&> arp(true); int nTotal = 5; for ( int ii = 0; ii < nTotal; ii++ ) { PERSON* pp = new PERSON; //assume memory allocated successfully. pp->nID = ii + 1; arp.Add(*pp); } //get the middle item to change its value. int nMid = nTotal/2; if ( nMid < nTotal ) { PERSON& pm = arp.GetAt(nMid); pm.nID = 12345; } for ( ii = 0; ii < nTotal; ii++ ) printf("Person %d's ID is : %d\n", ii + 1, arp.GetAt(ii).nID); }
Array::SetAt
Array.h