vbs - 一个简单的栈 -- 只能存储类对象
2016-07-25 20:59
591 查看
'----------------------------堆栈------------------------------------- Const MAX_STACK = 1024 Class MyStack Private int_Top '声明变量top Private int_Bottom '声明变量now Private strStack(1024) '声明堆数组 'Initialize 构建函数 Private Sub Class_Initialize top = 0 bottom = 0 End Sub '定义属性的获取和设置,如果设置为 Private 则需要这样来获取与赋值 Public Property Get top ' 获取 top = int_Top End Property Public Property Let top(strVar) ' 设置 int_Top = strVar End Property Public Property Get bottom bottom = int_Bottom End Property Public Property Let bottom(strVar) int_Bottom = strVar End Property Private Property Get stack(i) ' 初学对什么时候用set有点乱... SET stack = strStack(i) End Property Private Property Let stack(i,strVar) SET strStack(i) = strVar End Property Private Property Get stacks stacks = strStack End Property '类方法 Public Sub push(temp) if top < MAX_STACK Then stack(top) = temp top = top + 1 Else WScript.Echo "push(temp):stack gone max......" End if End Sub Public Function pop() if top > bottom Then SET pop = stack(top-1) top = top -1 Else pop = 0 WScript.Echo "pop():stack gone bug......" End if End Function Public Function Count() Count = top - bottom End Function End Class '----------------------------堆栈-------------------------------------
相关文章推荐
- vbs 实现文件夹拷贝--采用堆栈不递归
- vbs 一些学习资料
- VB程序学习代码记录20160725
- vbox安装ubuntu 16.04时出现"busybox-initramfs"
- iWebOffice使用VBA控制字体
- Excel中VBA进行插入列、格式化、排序
- 【EVB-335X-II试用体验】 Yocto环境的建立及Rootfs的构建与使用(2)
- 【EVB-335X-II试用体验】 u-boot与kernel的编译以及本地repo的建立
- 【EVB-335X-II试用体验】 Yocto环境的建立及Rootfs的构建与使用
- 【EVB-335X-II试用体验】 上手试用与资源使用
- VB.Net中点击按钮(Button)会重复提交两次表单
- VBA 实现学校上课教员一学期中所有上课时间,在一页中通过背景底色反应出来
- VB程序学习代码记录20160724
- 用vbs 将有序文件转换为有序文件
- VB程序学习代码记录20160723(2)
- VB6.0和VB.NET区别
- 多媒体文件格式之RMVB
- VB程序学习代码记录20160723
- VB操作EXCEL
- 利用VBA自动保存outlook附件