OpenEdge.Core.Collection.Stack abstract?

Posted by bronco on 12-Mar-2016 09:47

Hi!

OE 11.6.1: I'm trying to instantiate a Stack object but I'm told that it's an abstract class, although the class browser suggests otherwise. Is this a bug or a feature? Of course I know I can inherit the Stack class, but this seems unnecessary.

Sample code:

using OpenEdge.Core.Collections.Stack.

define variable elementStack as Stack no-undo.

elementStack = new Stack().   /* error 15107 */

Cheers

Posted by Bill Wood on 12-Mar-2016 10:36

A Stack Object is indeed an Abstract Class so it can't be directly instantiated.  See

 documentation.progress.com/.../index.html

It is a Collection they had methods supporting Last-in, First-Out (LIFO) semantics.

Implementations of the abstract class are necessary where the type of object in the stack is specified.   You might want to create, for example, and ObjectStack.  See

 documentation.progress.com/.../index.html

Once created you can cast it as a "Stack" and use the Stack methods generically (or not).  

All Replies

Posted by Bill Wood on 12-Mar-2016 10:36

A Stack Object is indeed an Abstract Class so it can't be directly instantiated.  See

 documentation.progress.com/.../index.html

It is a Collection they had methods supporting Last-in, First-Out (LIFO) semantics.

Implementations of the abstract class are necessary where the type of object in the stack is specified.   You might want to create, for example, and ObjectStack.  See

 documentation.progress.com/.../index.html

Once created you can cast it as a "Stack" and use the Stack methods generically (or not).  

Posted by bronco on 13-Mar-2016 01:51

Ah, I overlooked ObjectStack. Thanks.

Posted by Peter Judge on 14-Mar-2016 07:50

As Bill notes, it's abstract. If the class bowser suggests otherwise that's a bug in the class browser,
 
Ideally the Stack should be concrete but (mainly) due to the lack of generic types there are subtypes instead. Currently only an ObjectStack.
 
 

This thread is closed