This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ->next = 0;
if (Head != 0)
curr = Head;
while (curr->next) // is this the end?
curr = curr->next;
curr->next = tmp;
Head = tmp;
Applied Programming bool LinkedList::Remove(char name, int& psize)
name, int psize
CustPtr tmp; //
// if (Head == 0)
psize = Head->partysize;
make a copy of the pointer to current head
tmp = Head;
Head = Head->next; // change the head
delete tmp; // delete old head's memory
return true; } Applied Programming So, where does the class get access to Head?
It's in the private section of the class.
In summary, the class has the following syntax
(for This declaration describes the interface to the
user – and to the compiler.
A user has access to those parts in the public
section, but not those in the private part.
The (private) data is protected. class classname
public: class classname
View Full Document
- Spring '14