CObList::AddTail

加入新項目的項目或清單加入至這份清單尾端。

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

參數

  • newElement
    要加入的 CObject 指標至這份清單。

  • pNewList
    另一個 CObList 清單的指標。在 pNewList 的項目都會加入至清單。

傳回值

第一個版本傳回新插入的項目的 位置 值。

備註

清單可以是空的則會在運算之前。

下表顯示類似 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 類別

階層架構圖

CObList::GetTail

CObList::RemoveTail