comp.lang.ada
 help / color / mirror / Atom feed
* Classwide Container
@ 1998-06-08  0:00 Yves Malette
  1998-06-08  0:00 ` Dale Stanbrough
  0 siblings, 1 reply; 2+ messages in thread
From: Yves Malette @ 1998-06-08  0:00 UTC (permalink / raw)



I am having trouble creating an array of  classes.....
that is the simplest way I can say it .... I have included a snippet of
code which can better explain my attempts.....


    type Base_Message_Rtype is tagged                       --base class

 record
     null;
 end record;

    type External_Message_Rtype is new Base_Message_Rtype with    --some
new class of message
 record
with their respective functions
     Sent_To : Send_Ptype := Send_Method'Access;
     Pending : Pending_Ptype := Pending_Method'Access;
 end record;

   type Message_Array_Rtype is
      array (Messages) of Base_Message_Rtype'Class;   -- an array that
can

contain message classes forever

as they become available...

the above example does'nt compile ( BASE_MESSAGE_RTYPE'CLASS must be
constrained )..
which I can agree with......

but I have spent three weeks with my trusty Cohen book and I know I can
constrain it by merely
turning my message_array component into a pointe..(oopss...access
type).....

type Node_Pointer_Type is access Base_Message_Rtype'Class;

type Message_Array_Rtype is
    array (Message_Etype) of Node_Pointer_Type;

this will compile, but unfortunately I can only access the methods from
my base class and not
the classwide access expected in the near future.......
              (Base_Message_Rtype'Class)

I trying create a simple classwide container............................
I am almost their...any help would
be appreciated

New Ada Guy ....

--
Thanks in advance.  Yves Bernard Malette   "Expect GREAT Things!"

"Disclaimer about my views and my employer goes here"

+-------------------------------------------------------+
| Raytheon Electronic Systems   ph (617) 274 3683       |
| Mail Stop: S1E-K116                                   |
| 180 Hartwell Road             ybm@gbr.msd.ray.com     |
| Bedford, MA 01730-2498                                |
+-------------------------------------------------------+







^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-06-08  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-08  0:00 Classwide Container Yves Malette
1998-06-08  0:00 ` Dale Stanbrough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox