int GetSize( ) const;
Remarks
Returns the size of the array. Since indexes are zero-based, the size is 1 greater than the largest index.
The following table shows other member functions that are similar to CObArray::GetSize.
| Class | Member Function |
| CByteArray | int GetSize( ) const; |
| CDWordArray | int GetSize( ) const; |
| CPtrArray | int GetSize( ) const; |
| CStringArray | int GetSize( ) const; |
| CUIntArray | int GetSize( ) const; |
| CWordArray | int GetSize( ) const; |
Example
See CObList::CObList for a listing of the CAge class used in all collection examples.
CObArray myArray;
// Add elements to the array.
for (int i=0;i < 10;i++)
myArray.Add( new CAge( i ) );
// Add 100 to all the elements of the array.
for (i=0;i < myArray.GetSize();i++)
{
CAge*& pAge = (CAge*&) myArray.ElementAt(i);
delete pAge;
pAge = new CAge( 100+i );
}
#ifdef _DEBUG
afxDump.SetDepth( 1 );
afxDump << "myArray: " << &myArray << "\n";
#endif
CObArray Overview | Class Members | Hierarchy Chart
See Also CObArray::GetUpperBound, CObArray::SetSize