CObList::AddHead
POSITIONAddHead(CObject*newElement);
throw(CMemoryException);
voidAddHead(CObList*pNewList);
throw(CMemoryException);
Return Value
The first version returns the POSITION value of the newly inserted element.
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.
Remarks
Adds a new element or list of elements to the head of this list. The list can be empty before the operation.
Example
See CObList::CObList for a listing of the CAge
class.
CObList list;
list.AddHead( new CAge( 21 ) ); // 21 is now at head.
list.AddHead( new CAge( 40 ) ); // 40 replaces 21 at head.
#ifdef _DEBUG
afxDump.SetDepth( 1 );
afxDump << "AddHead example: " << &list << "\n";
#endif
The results from this program are as follows:
AddHead example: A CObList with 2 elements
a CAge at $44A8 40
a CAge at $442A 21
CObList Overview | Class Members | Hierarchy Chart
See Also CObList::GetHead, CObList::RemoveHead