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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,de1c23707584fc3c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-22 07:56:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!news.nask.pl!news.cyf-kr.edu.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail From: "kat-Zygfryd" <6667@wp.pl> Newsgroups: comp.lang.ada Subject: Re: virtual destructors Date: Tue, 22 Apr 2003 16:56:03 +0200 Organization: news.onet.pl Sender: samael_@op.pl@pl125.poznan.cvx.ppp.tpnet.pl Message-ID: References: NNTP-Posting-Host: pl125.poznan.cvx.ppp.tpnet.pl X-Trace: news.onet.pl 1051023369 7540 217.99.113.125 (22 Apr 2003 14:56:09 GMT) X-Complaints-To: abuse@onet.pl NNTP-Posting-Date: 22 Apr 2003 14:56:09 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Xref: archiver1.google.com comp.lang.ada:36346 Date: 2003-04-22T14:56:09+00:00 List-Id: "Stephen Leake" wrote in message news:u1xzuehed.fsf@nasa.gov... > The nearest equivalent of C++ destructors is achieved by deriving from > a type declared in Ada.Finalization. Note that it is not a very close > equivalent, so to be really helpful, we need to know in a larger sense > what you are trying to do. > > -- > -- Stephe I want to have destructors working on access' to class wide types, so that when passed a variable, an actual type destructor was called, not a one overloaded for the specific type. example: type Base is tagged record ... end record; type PBase is access Base; type CBase is access Base'Class; type Derived is new Base with record ... end record; type PDerived is access Derived; type CDerived is access Derived'Class; procedure Free is new Ada.Unchecked_Deallocation(Base,PBase); procedure Free is new Ada.Unchecked_Deallocation(Derived,PDerived); procedure Dispose(self: in out CBase) is begin --? self := null; end Dispose; procedure Dispose(self: in out CDerived) is begin -- ? self := null; end Dispose; declare B: CBase := new Base; D: CBase := new Derived; begin Dispose(B); Dispose(D); end; I want both Disposes to work as they should, what should I fill them with? Zygfryd