Because VBA supports class modules and because you can create a new instance of a class (that is, instantiate a new member of the class) at any time, you can create class modules that emulate these abstract data structures. Each element of the structure, because it’s just like every other element, is just another instance of the class. (For information on getting started with class modules, see Chapter 5.)
You can most easily represent abstract structures in VBA using two class modules: one to represent a datatype that does nothing more than point to the real data structure, and another to represent each element of the structure. For example, if you want to create a stack data structure (and we will, later in this section), you’ll need one class module to act as a pointer to the “top” of the stack. This is where you can add new items to the stack. You’ll also need a different class module for the elements in the stack. This class module will contain two pieces of data: the information to be stored in the stack and a reference to the next lower item on the stack.