CObList::AddTail

添加一个新元素或列表元素到此的尾列表。

POSITION AddTail( 
   CObject* newElement  
); 
void AddTail( 
   CObList* pNewList  
);

参数

  • newElement
    要添加的 CObject 指向此列表。

  • pNewList
    到另一 CObList 的指针列表。 在 pNewList 的组件将添加到此列表。

返回值

第一个版本返回新插入的元素的 POSITION 值。

备注

该列表可为null在操作之前。

下表显示类似于 CObList::AddTail的其他成员函数。

成员函数

CPtrList

POSITION AddTail( void* newElement);

void AddTail( CPtrList* pNewList);

CStringList

POSITION AddTail( const CString& newElement);

POSITION AddTail( LPCTSTR newElement);

void AddTail( CStringList* pNewList);

示例

用于列表 CAge 选件类参见 CObList::CObList

CObList list;
list.AddTail(new CAge(21));
list.AddTail(new CAge(40)); // List now contains (21, 40).
#ifdef _DEBUG
   afxDump.SetDepth(1);
   afxDump << _T("AddTail example: ") << &list << _T("\n");
#endif      

从此过程的结果如下:

AddTail example: A CObList with 2 elements

a CAge at $444A 21

a CAge at $4526 40

要求

Header: afxcoll.h

请参见

参考

CObList Class

层次结构图

CObList::GetTail

CObList::RemoveTail