typedef struct _tagLinkedList
{
_tagLinkedList *pNextLink;
int m_iData;
_tagLinkedList()
{
pNextLink = NULL;
}
~_tagLinkedList()
{
if (pNextLink )
delete pNextLink;
pNextLink = NULL
}
}sLinkedList;
Sunday, July 16, 2006
Subscribe to:
Post Comments (Atom)
2 comments:
May be it should have some member functions to add a node to the list. Normally I would prefer to use list STL, because that avoids handling memory hassles and is more generic.
Vipin
Yes to make it an ADT we need to add many member functions , this is just an example to show the proper use of the structures destructor.
Post a Comment