From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,46474020a5b291b7,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!b28g2000cwb.googlegroups.com!not-for-mail From: "ldb" Newsgroups: comp.lang.ada Subject: Free'ing dynamic abstract tagged types.. Date: 21 Sep 2006 14:08:04 -0700 Organization: http://groups.google.com Message-ID: <1158872883.994303.80430@b28g2000cwb.googlegroups.com> NNTP-Posting-Host: 206.210.81.52 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1158872887 429 127.0.0.1 (21 Sep 2006 21:08:07 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 21 Sep 2006 21:08:07 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: b28g2000cwb.googlegroups.com; posting-host=206.210.81.52; posting-account=V3awPg0AAAB11Uk1Sshvlrxz0peUf-At Xref: g2news2.google.com comp.lang.ada:6689 Date: 2006-09-21T14:08:04-07:00 List-Id: 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.