comp.lang.ada
 help / color / mirror / Atom feed
From: Yves Malette <ybm@gbr.msd.ray.com>
Subject: Classwide Container
Date: 1998/06/08
Date: 1998-06-08T00:00:00+00:00	[thread overview]
Message-ID: <357BFD07.37A379C3@gbr.msd.ray.com> (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                                |
+-------------------------------------------------------+







             reply	other threads:[~1998-06-08  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-08  0:00 Yves Malette [this message]
1998-06-08  0:00 ` Classwide Container Dale Stanbrough
replies disabled

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