![]() |
![]() |
![]() |
![]() |
![]() |
|
Fortunately, you can create lists without using internal pointers. You can
create a new class, the link class. Objects in this new class have
two pointers; one points to the next link object, and the other
points to a railroad_car object. The following illustrates the role
of link objects in a three-car train list:
*-------* *-------* *-------* Three link objects
| | ----> | | ----> | 0 |
|-------| |-------| |-------|
| | | | | |
*-------* *-------* *-------*
| | |
v v v
*-------* *-------* *-------* Three railroad_car objects
| | | | | |
|-------| |-------| |-------|
| | | | | |
In this illustration, the pointers are called external pointers, because they are stored outside the class objects.