Demo of the Stack Class
test! is on the top of the stack.

Outputting the stack contents:
test!
a
is
This


The above demo was generated using the following code:

<% Option Explicit %>
<!--#include file="Stack.Class.asp"-->
<%
  Dim objStack
  Set objStack = new Stack

  'Push some data on the stack
  objStack.Push("This ")
  objStack.Push("is ")
  objStack.Push("a ")
  objStack.Push("test! ")

  'What is on the top?
  Response.Write objStack.Peek() & " is on the top of the stack.<P>"

  'Remove all the data displaying it
  Response.Write "<B>Outputting the stack contents:</B><BR>"
  While objStack.Count > 0
    Response.Write objStack.Pop() & "<BR>"
  Wend

  set objStack = nothing
%>


  • [Read the article]
  • [Download the source to WeakList.Class.asp in text format]
  • [Download the source to Stack.Class.asp in text format]