CObArray::Add
Dizi 1 ile büyüyen bir dizi sonuna yeni bir öğe ekler.
INT_PTR Add(
CObject* newElement
);
Parametreler
- newElement
CObject Bu diziye eklenen işaretçi.
Dönüş Değeri
Eklenen öğenin dizini.
Notlar
SetSize ile kullanılan bir nGrowBy 1, daha sonra fazladan bellek büyük değer ayrılmış.Ancak, üst sınır yalnızca 1 artar.
Diğer üye benzer işlevleri aşağıdaki tabloda gösterilmektedir CObArray::Add.
Sınıf |
Üye işlevi |
---|---|
INT_PTR Add( BYTE newElement); CMemoryException oluştun throw; |
|
INT_PTR Add( DWORD newElement ); CMemoryException oluştun throw; |
|
INT_PTR Add( void* newElement ); CMemoryException oluştun throw; |
|
INT_PTR Add( LPCTSTR newElement );CMemoryException oluştun throw; INT_PTR Add(const CString& newElement); |
|
INT_PTR Add( UINT newElement ); CMemoryException oluştun throw; |
|
INT_PTR Add( WORD newElement ); CMemoryException oluştun throw; |
Örnek
Bkz: CObList::CObList bir listesi için CAge tüm koleksiyon örneklerde kullanılan sınıf.
CObArray arr;
arr.Add(new CAge(21)); // Element 0
arr.Add(new CAge(40)); // Element 1
#ifdef _DEBUG
afxDump.SetDepth(1);
afxDump << _T("Add example: ") << &arr << _T("\n");
#endif
Bu programdan sonuçlar aşağıdaki gibidir:
Add example: A CObArray with 2 elements
[0] = a CAge at $442A 21
[1] = a CAge at $4468 40
Gereksinimler
Başlık: afxcoll.h