The ListItem Class

The code for the ListItem class, shown below, is simple, as you can see in List-ing 6.9. The code should look very familiar; it’s parallel to the code in Listing 6.1. (Remember, the Stack data structure is just a logical extension of the linked list.)

Public Value As Variant
Public NextItem As ListItem

The class module contains storage for the value to be stored in the node, plus a pointer to the next node. As you instantiate members of this class, you’ll set the NextItem property to refer to the next item in the list, which depends on where in the list you insert the new node.

© 1997 by SYBEX Inc. All rights reserved.