comp.lang.ada
 help / color / mirror / Atom feed
From: "Frank" <franjoe@frisurf.no>
Subject: new/free of abstract types
Date: 31 Mar 2003 08:41:14 +0100
Date: 2003-03-31T08:41:14+01:00	[thread overview]
Message-ID: <3e87f119$1@news.wineasy.se> (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; <---------------??????










             reply	other threads:[~2003-03-31  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-31  7:41 Frank [this message]
2003-03-31 15:59 ` new/free of abstract types Matthew Heaney
2003-04-01  8:30   ` Frank
2003-04-01 15:13     ` Matthew Heaney
replies disabled

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