"The code is exactly
how I would like to write code and the algorithms used are very
efficient and well-documented."
Van T. Dinh, Microsoft MVP
|
|
Class: CStack
Class that implements a stack. A stack is a restricted form of a list. All insertions and deletions occur at one end of the list.
The stack data type defines three operations, Push, Pop, and Top.
- Push places an item on the top of the list
- Pop removes an item from the top of the list
- Top retrieves, but does not remove, an item from the top of the list
The stack is a LIFO, or Last-In, First-Out, data type. This means that data enters and exits from the same end of the list. An example of a stack is a spring loaded plate dispenser in a cafeteria. The last plate placed in the dispenser is the first one removed.
This class is implemented using an array based approach. When the array becomes full, the array is grown by the amount specified in the GrowBy property. This class supports object variables in addition to the standard text and numeric types.
|
Procedure Name
|
Type
|
Description
|
|
(Declarations)
|
Declarations
|
Declarations and private variables for the CStack class
|
|
GrowBy
|
Property
|
Gets the amount the stack grows by when it needs to be reallocated.
The default value is ten. If you know that hundreds of items are going to placed on the stack, you can increase this number to reduce the number of ReDims of the mavarData array.
|
|
Class_Initialize
|
Initialize
|
Sets initial values
|
|
Pop
|
Method
|
Removes the topmost item off the stack, and places it in the varData variable
|
|
Push
|
Method
|
Pushes the data specified in varData on the top of the stack.
If the stack is full, it grows by the amount specified by the GrowBy property.
|
|
Top
|
Method
|
Returns the item on the top of the stack. This function differs from pop in that it does not remove the item from the stack.
|
Overview of Total Visual SourceBook
The source code in Total Visual
SourceBook includes modules and classes for Microsoft Access, Visual
Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily
add this professionally written, tested, and documented royalty-free code
into your applications to simplify your application development efforts.
Additional Resources
|
|