At this point, you are ready to learn about an
implementation of lists using external pointers. This implementation
involves not only a link
class, but also a
header
class. Each header
object,
one per list, contains a pointer to the first link
object. If the list is empty, the link
pointer is the
null pointer, as in the following illustration:
*-------* A header object | | |-------| | 0 | A null pointer to first link object *-------*
The following illustration shows a list that contains three cars:
*-------* A header object | | |-------| | | *-------* | v *-------* *-------* *-------* Three link objects | | ----> | | ----> | 0 | |-------| |-------| |-------| | | | | | | *-------* *-------* *-------* | | | v v v *-------* *-------* *-------* Three railroad_car objects | | | | | | |-------| |-------| |-------| | | | | | |