comp.lang.ada
 help / color / mirror / Atom feed
* new/free of abstract types
@ 2003-03-31  7:41 Frank
  2003-03-31 15:59 ` Matthew Heaney
  0 siblings, 1 reply; 4+ messages in thread
From: Frank @ 2003-03-31  7:41 UTC (permalink / raw)


Hi!

Regarding: GNAT3-15p/Windows XP/Ada95

I have an abstract type, and wish to perform a new/free of objects extended
from this type, inside one of the methods/subprograms
that has the abstract type as a classwide parameter (in one of the type
methods, to say it in Java/C++ language).see eksample below.

It seems that I cant to it this way:

See example below to see how "The_New_Object" is declared:

The_New_Object := new MyType;

because the real property of the type is not fully known in the scope.

What I wish is to create a new object of the same type as the object
"P_Parameter" (see example below).
Can it be done - if so, how is the syntax?

I havent yet tried to do this with the "Freeing" method, so a tip about that
would also be appreciated.


Frank

eksample:
---------------
type Pointer_To_MyType is access all MyType;

type A_Type is record
   The_New_Object : Pointer_To_MyType;
end record;

Something_Global : A_Type;


---------------
  procedure Subprogram ( .......
                                      P_Parameter : out MyType'Class) is

....
...
  begin
.....
....
      Someething_Global.The_New_Object := new MyType; <---------------??????










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

end of thread, other threads:[~2003-04-01 15:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-31  7:41 new/free of abstract types Frank
2003-03-31 15:59 ` Matthew Heaney
2003-04-01  8:30   ` Frank
2003-04-01 15:13     ` Matthew Heaney

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