clsstack.cls

来自「编译原理课程设计用vb编写」· CLS 代码 · 共 52 行

CLS
52
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsStack"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private s As New Collection


Public Sub Push(ByVal Item As Variant)
    If s.Count = 0 Then
        s.Add Item
    Else
        s.Add Item, , 1
    End If
End Sub

Public Function Pop()
    t = s.Item(1)
    s.Remove 1
    Pop = t
End Function

Public Function Clear()
    While s.Count > 0
        s.Remove 1
    Wend
End Function

Public Property Get Count() As Variant
    Count = s.Count
End Property

Public Property Let Count(ByVal vNewValue As Variant)
    
End Property

Public Property Get Item(ByVal i As Integer) As Variant
    '从0开始,不是从1开始,注意注意~~~
    Item = s.Item(i + 1)
End Property

Public Property Let Item(ByVal i As Integer, ByVal vNewValue As Variant)
End Property

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?