The C++Course provides a general introduction to programming in C++. It is based on A.B. Downey's book, How to Think Like a Computer Scientist. Click here for details. |
Home Linked lists Wrappers and Helpers | ||
Wrappers and Helpers
cout << '('; if (list != null) { Node *head = list; Node *tail = list->next; printBackward (tail); cout << head->cargo; } cout << ')'; } Again, it is a good idea to check methods like this to see if they work with special cases like an empty list or a singleton. Elsewhere in the program, when we use this method, we will invoke printBackwardNicely directly and it will invoke printBackward on our behalf. In that sense, printBackwardNicely acts as a wrapper, and it uses printBackward as a helper.
|
||
Home Linked lists Wrappers and Helpers |