A Classy Little Stack
by Tom Brennfleck - GUI Computing
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.
|
|
If you wish to use it.... use it wisely.<g> |
The code for this stack class is included in the
downloadable zip
file (8kb).