Revision: 24174
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 22, 2010 16:11 by heatherk
Initial Code
Option Explicit
Private iColl As Collection
Private curIndex As Integer
Public Property Get TopValue() As Integer
TopValue = iColl(curIndex)
End Property
Public Property Get Count() As Integer
Count = curIndex
End Property
Private Sub Class_Initialize()
Set iColl = New Collection
curIndex = 0
End Sub
Public Sub Push(item As Integer)
If curIndex = 0 Then
iColl.Add item
Else
iColl.Add item, , , curIndex
End If
curIndex = curIndex + 1
End Sub
Public Function Pop() As Integer
Dim PoppedItem As Integer
PoppedItem = iColl(curIndex)
iColl.Remove curIndex
curIndex = curIndex - 1
Pop = PoppedItem
End Function
Public Sub Clear()
Dim i As Integer
Do Until iColl.Count = 0
iColl.Remove curIndex
curIndex = curIndex - 1
Loop
End Sub
Private Sub Class_Terminate()
Set iColl = Nothing
End Sub
Initial URL
Initial Description
Wrapper class around a `Collection` object in VB6 to produce a stack for storing `Integers`.
Initial Title
Integer Stack Class
Initial Tags
Initial Language
Visual Basic