How to implement the vbs stack class
This article will explain in detail how to implement the vbs stack class, Xiaobian thinks it is quite practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.
The problem of data structure is very important. If you can describe the input and output data structure of a problem, then this problem is very promising. Data structure is not patented by C language. The real data structure is pseudocode. The stack class below is the code I collected from others before. In fact, whenever you think about a program problem, especially a complex program, you should think about what kind of data to describe your input and output.
'**********************************************
' vbs stack class
' push(string)
' getTop fetches the top element of the stack
' pop remove top element of stack
' isempty Is the stack empty
' isfull Whether the stack is full (pMax set the size, can be modified)
'**********************************************
class Stack
private pArr, pString, pMax
private tab
private sub class_initialize()
tab=chr(9)
pMax=1000 'maximum capacity
end sub
private sub class_terminate()
if isarray(pArr) then
erase pArr
end if
end sub
public function push(str)
if str"" and instr(str,tab)