comp.lang.ada
 help / color / mirror / Atom feed
* Free'ing dynamic abstract tagged types..
@ 2006-09-21 21:08 ldb
  2006-09-21 22:12 ` Randy Brukardt
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: ldb @ 2006-09-21 21:08 UTC (permalink / raw)


Ok, so I have this abstract tagged type called Person (for the sake of
discussion), and I have an Access_Person (which is access all
people'class).

I have some derived types, like Man and Child, with their own added
fields. And I have defined Access_Man, Access_Child, as normal accesses
to these types.

I want to free an Access_Person that was dynamically allocated.
ap : Access_Person;
begin
ap := Access_Person(new Man);
free(ap);
...

I can't figure out how to write the free routine, since unchecked
deallocation wants a pointer (presumably access_man), but all I have is
a class-wide pointer, and I can't figure out how, or if, I can convert
it. Does that make sense?

Using free(ap.all), I can make an abstract function that will dispatch
and free any nested allocations, but I can't seem to get it to free the
record, itself.




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

end of thread, other threads:[~2006-09-26  0:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-21 21:08 Free'ing dynamic abstract tagged types ldb
2006-09-21 22:12 ` Randy Brukardt
2006-09-22  7:41   ` Alex R. Mosteo
2006-09-26  0:08     ` Randy Brukardt
2006-09-21 22:12 ` Robert A Duff
2006-09-22  7:21 ` Dmitry A. Kazakov
2006-09-22 21:59 ` Jeffrey R. Carter

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