Question: how to store Objects in an Array?

I wanted to create an Array() to store only objects of specific type in it.  

Array() supports the datatype=value  telling it the type of elements to store. But when I try to create an Array() using datatype of the class, it fails. I must be doing something wrong. Here is an example

module solution_class()
      option object;
      local sol::anything;
end module;
sol:=Object(solution_class); #create an object

Now the following works:


But I wanted to do

A(1) := sol;

 Error, unable to store '0' when datatype=module solution_class () local sol::anything; option object; end module

Help says 

And this is the case here, because type(sol,solution_class)  gives true

So 'solution_class' is valid type name.

Where is my error?



Please Wait...