// Append a cLinkedList item onto the list. public void Append(cLinkedList pList) { // If there's a mpNext, send the message down the list // If not, then mpNext becomes the input pList pointer if (mpNext != null) mpNext.Append(pList); else mpNext = pList; }
// Append an object onto the list public void Append(object pObject) { cLinkedList pListItem = new cLinkedList(pObject); Append(pListItem); }
// Default Constructor public cLinkedList() { mpNext = null; mpListItem = null; }
// Overwridden Constructor taking an object pointer public cLinkedList(object pObject) { mpNext = null; mpListItem = pObject; }
// Remove a specific object from the list public cLinkedList RemoveItem(object pItem) { cLinkedList pList; if (mpNext != null) { if (mpNext.mpListItem == mpListItem) { pList = mpNext; mpNext = pList.mpNext; pList.mpNext = null; return pList; } else return mpNext.RemoveItem(pItem); } else return null; }