网站首页  计算机词典

请输入您要查询的字词:

 

字词 CObArray::SetAtGrow
释义 CObArray::SetAtGrow

void SetAtGrow( int nIndex, CObject* newElement );
  throw( CMemoryException );

参数:
nIndex大于或等于0的整数索引值。
newElement新增到该数组的对象指针,该值允许为空值。

说明:
在指定索引处设定数组元素。如果必要,那么数组将自动增长(也就是说,数组上界将自动调节,以容纳新的元素)。
下表列出了类似于CObArray::SetAtGrow函数的其它成员函数。
类成员函数
CByteArrayvoid SetAtGrow( int nIndex, BYTE newElement );
  throw( CMemoryException );
CDWordArrayvoid SetAtGrow( int nIndex, DWORD newElement );
  throw( CMemoryException );
CPtrArrayvoid SetAtGrow( int nIndex, void* newElement );
  throw( CMemoryException );
CStringArrayvoid SetAtGrow( int nIndex, LPCTSTR newElement );
  throw( CMemoryException );
CUIntArrayvoid SetAtGrow( int nIndex, UINT newElement );
  throw( CMemoryException );
CWordArrayvoid SetAtGrow( int nIndex, WORD newElement );
  throw( CMemoryException );

示例:
请参阅CObList::CObList,了解所有收集示例中使用的CAge类。
// example for CObArray::SetAtGrow
CObArray array;
array.Add( new CAge( 21 ) ); // Element 0
array.Add( new CAge( 40 ) ); // Element 1
array.SetAtGrow( 3, new CAge( 65 ) ); // Element 2 deliberately// skipped
#ifdef _DEBUG
   afxDump.SetDepth( 1 );
   afxDump << "SetAtGrow example: " << &array << "\";
#endif
该程序的结果如下:
SetAtGrow example: A CObArray with 4 elements
[0] = a CAge at $47C0 21
[1] = a CAge at $4800 40
[2] = NULL
[3] = a CAge at $4840 65

请参阅:
CObArray::GetAt, CObArray::SetAt, CObArray::ElementAt, CObArray::operator []
随便看

 

计算机英汉双解词典包含34412条计算机术语英汉翻译词条,基本涵盖了全部常用计算机术语的翻译及用法,是计算机学习及翻译工作的有利工具。

 

Copyright © 2021-2025 foosec.com All Rights Reserved
更新时间:2026/10/23 20:48:26