CObList::AddTail

Adds a new element or list of elements to the tail of this list.

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

Parameters

  • newElement
    The CObject pointer to be added to this list.

  • pNewList
    A pointer to another CObList list. The elements in pNewList will be added to this list.

Return Value

The first version returns the POSITION value of the newly inserted element.

Remarks

The list can be empty before the operation.

The following table shows other member functions that are similar to CObList::AddTail.

Class

Member Function

CPtrList

POSITION AddTail( void* newElement );

void AddTail( CPtrList* pNewList );

CStringList

POSITION AddTail( const CString& newElement );

POSITION AddTail( LPCTSTR newElement );

void AddTail( CStringList* pNewList );

Example

See CObList::CObList for a listing of the CAge class.

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      

The results from this program are as follows:

AddTail example: A CObList with 2 elements

a CAge at $444A 21

a CAge at $4526 40

Requirements

Header: afxcoll.h

See Also

Reference

CObList Class

Hierarchy Chart

CObList::GetTail

CObList::RemoveTail