Image of Navigational Map linked to Home / Contents / Search A Classy Little Stack

by Tom Brennfleck - GUI Computing
Image of Line Break

I needed to implement a stack recently and I thought to myself what a good way to get into classes.

Obviously, this little stack class is a pretty trivial example, but it's a start. It has only two properties -
.Count (a count of the items in the stack) and
.IsEmpty (which is, I would would assume, self-explanatory).

The methods are just as straightforward - .Push, .Pop, .Clear and .GetPopValue.

It may be simple, but it's already served me well a few times. That's the great thing about classes - they really are reusable.

Image of How-To Icon

If you wish to use it.... use it wisely.<g>

The code for this stack class is included in the downloadable zip file (8kb).


Written by: Tom Brennfleck
April 96

Image of Arrow linked to Next Article
Image of Line Break
[HOME] [TABLE OF CONTENTS] [SEARCH]