comp.lang.ada
 help / color / mirror / Atom feed
* Pointers explained?
@ 2007-07-30 17:53 shaunpatterson
  0 siblings, 0 replies; 20+ messages in thread
From: shaunpatterson @ 2007-07-30 17:53 UTC (permalink / raw)


Hi

   I'm still relatively new to Ada -- coming from a strong C++
background.  Some of this may seem stupid - and feel free to point it
out to me.  I am using Ada 95 - GNAT Pro 3.16a1


I have a message factory I've been screwing around with (converting it
from Ada to C++).

I basically have an abstract message type:

type Message is abstract tagged null record;
type Message_Class is access all Message'Class;


then all other messages are derived from this.

Now from my factory create method, I'm returning a Message_Class.
This message_class
is stored in another record to be handled again later:

type CallbackEvent is
record
     msg : Message_Class;
     ...
end record;


Now my basic problem -- or not really a problem -- is that to create
the Message_Class I have to use
"new" and allocate and deallocate memory.

Now - my solution was to re-write my message factory to return a type
Message'Class.  However, I went
to change my callback structure to:

type CallbackEvent is
record




^ permalink raw reply	[flat|nested] 20+ messages in thread
* Pointers explained?
@ 2007-07-30 17:53 shaunpatterson
  2007-07-30 17:56 ` shaunpatterson
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: shaunpatterson @ 2007-07-30 17:53 UTC (permalink / raw)


Hi

   I'm still relatively new to Ada -- coming from a strong C++
background.  Some of this may seem stupid - and feel free to point it
out to me.  I am using Ada 95 - GNAT Pro 3.16a1


I have a message factory I've been screwing around with (converting it
from Ada to C++).

I basically have an abstract message type:

type Message is abstract tagged null record;
type Message_Class is access all Message'Class;


then all other messages are derived from this.

Now from my factory create method, I'm returning a Message_Class.
This message_class
is stored in another record to be handled again later:

type CallbackEvent is
record
     msg : Message_Class;
     ...
end record;


Now my basic problem -- or not really a problem -- is that to create
the Message_Class I have to use
"new" and allocate and deallocate memory.

Now - my solution was to re-write my message factory to return a type
Message'Class.  However, I went
to change my callback structure to:

type CallbackEvent is
record




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

end of thread, other threads:[~2007-08-10 19:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-30 17:53 Pointers explained? shaunpatterson
  -- strict thread matches above, loose matches on Subject: below --
2007-07-30 17:53 shaunpatterson
2007-07-30 17:56 ` shaunpatterson
2007-07-30 19:04   ` Ed Falis
2007-07-30 19:05   ` Ludovic Brenta
2007-07-30 19:36   ` Adam Beneschan
2007-07-30 21:23     ` Maciej Sobczak
2007-07-30 22:36       ` Adam Beneschan
2007-07-31  7:33         ` Dmitry A. Kazakov
2007-07-31  1:15       ` Anh Vo
2007-07-30 22:20     ` Adam Beneschan
2007-07-30 21:31   ` Jeffrey R. Carter
2007-07-31 17:21   ` Simon Wright
2007-07-31 18:06     ` Dmitry A. Kazakov
2007-07-31 22:38       ` shaunpatterson
2007-08-01  7:53         ` Martin Krischik
2007-08-01  8:21         ` Dmitry A. Kazakov
2007-08-10 19:52         ` Simon Wright
2007-07-30 20:11 ` Dmitry A. Kazakov
2007-07-31  8:28 ` Martin Krischik

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