Thanks, Ron,

I don't think so. It is more like instantiating a stack class with each instance of that class (a stack object) having a "MaxDepth" space allocated to it. Then each time I "NEW CLS_Stack", I would get a stack object of "MaxDepth" elements. (I am ignoring the TopOfStack, Push, Pop, etc. for now.)

What I think I'm hearing from Doug and Aaron is that the stack is actually defined outside the context of the class. If I then want a stack of "MaxDepth", I have to call the "CLS_Stack.Init (MaxDepth)" in order to obtain an array named S5. I think I then need:

SET S5 = (NEW CLS_Stack).Init(MaxDepth)
which will make S5 an array of "MaxDepth" elements. So, my confusion and question really comes down to, "Where do I declare the array that is my stack?" I thought I could do it inside the Class block, hopefully parameterizing the class somehow so that I could have something like:

SET S5 = NEW CLS_Stack(MaxDepth)
and
Set S12 = NEW Cls_Stack(MonthsPerYear)
etc.

I understand this is not permitted as VBS does not support parameterizing a class. This is a shame IMHO because so many classes seem to be a natural "List" of other objects.

Redim can certainly handle the dynamic fluctuations in the depth of a stack, but that seems to me to be operative only after the stack is set up in the first place.

I can imagine a whole collection of objects organized in all manner of data structures -- queues, trees, graphs, ... All of these structures could be restricted to a given, well defined, set of some number of objects.

So, on to the WIKI articles which I assume are at AppCentral. Thanks, Aaron, for that lead.

Dave

At 11:01 AM 4/30/2012, you wrote:
On 4/30/2012 1:52 PM, David Helkenn wrote:
private someStack ' AARRGGGG how many?

Does redim solve this problem for you?

http://msdn.microsoft.com/en-us/library/c850dt17%28v=vs.84%29.aspx


Reply via email to