comp.lang.ada
 help / color / mirror / Atom feed
From: gate02@wrandyke.demon.co.uk (Michael Mounteney)
Subject: Hierarchy destruction in Ada
Date: 12 Dec 2004 07:18:32 -0800
Date: 2004-12-12T07:18:32-08:00	[thread overview]
Message-ID: <fa59671.0412120718.61093406@posting.google.com> (raw)

Ada 95 provides a mechanism with tagged and type'class to allow
dynamic dispatch. So if one has:

procedure something (O : basetype'class) is
begin
     enact (O);
end something;

then as we all know, with the appropriate redefinitions of enact ()
for the subtypes of basetype, we have dynamic dispatch.  But what
about deallocation ? I want to declare:

type handle is access all basetype;

procedure dispose (ptr : in out handle);

and can't see how to make this deallocate the correct object.
Obviously, one can dynamically dispatch on ptr.all but it seems
impossible to solve the complete problem without an unchecked
conversion. Anyone ?



             reply	other threads:[~2004-12-12 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-12 15:18 Michael Mounteney [this message]
2004-12-12 15:38 ` Hierarchy destruction in Ada Dmitry A. Kazakov
2004-12-12 16:52 ` Martin Krischik
2004-12-13 13:41 ` Martin Krischik
replies disabled

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