nieważne SetAtGrow ( int nIndex, CObject * newElement );
rzut ( CMemoryException );
Parametry
nIndex
Indeks liczba całkowita, która jest większa lub równa 0.
newElement
Wskaźnik obiekt ma być dodana do tej tablicy. Dozwolone wartości NULL.
Uwagi
Ustawia elementu tablicy pod określonym indeksem. Tablica automatycznie rośnie w razie potrzeby (Górna granica jest dostosowana do dostosowania nowego elementu).
W poniższej tabeli przedstawiono inne funkcje składowe, które są podobne do CObArray::SetAtGrow.
| Klasa | Funkcja Państwa |
| CByteArray | void SetAtGrow (i&nt nIndex, BAJT newElement ); nbsp;rzut ( CMemoryException ); |
| CDWordArray | void SetAtGrow (i&nt nIndex, DWORD newElement ); nbsp;rzut ( CMemoryException ); |
| CPtrArray | void SetAtGrow (i&nt nIndexvoid *, newElement ); nbsp;rzut ( CMemoryException ); |
| CStringArray | void SetAtGrow (i&nt nIndex, LPCTSTR newElement ); nbsp;rzut ( CMemoryException ); |
| CUIntArray | void SetAtGrow (int nIndex, UI&NT newElement ); nbsp;rzut ( CMemoryException ); |
| CWordArray | void SetAtGrow (i&nt nIndex, program WORD newElement ); nbsp;rzut ( CMemoryException ); |
Przykład
Zobacz CObList::CObList listę CAge klasy wykorzystywane we wszystkich przykładach kolekcji.
/ / przykład CObArray::SetAtGrow
nbsp; Tablica CObArray;
Tablica.Dodaj (nowe CAge (21)); / / Element 0
Tablica.Dodaj (nowe CAge (40)); / / Element 1
Tablica.SetAtGrow (nowe klatki 3 (65)); / / Element 2 celowo
/ / pominięte.
#ifdef _DEBUG
afxDump.SetDepth (1);
afxDump << "SetAtGrow przykład:" << & tablicy << "" \n";
#ENDIF
Wyniki tego programu są następujące:
SetAtGrow przykład: CObArray 4 elementy
nbsp; [0] = koszyk w 47 C $0 21
[1] = klatki na $4800 40
[2] = &NULL
[3] = klatki na $4840 65
Omówie&nie CObArray |nbsp; Klasa członków | Wykres hierarchii
Zobacz też CObArray::GetAt, CObArray::SetAt, CObArray::ElementAt, [CObArray::operator]