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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7149ea26d9d2075c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-05 04:49:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!feed.news.nacamar.de!newsfeed.vmunix.org!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Upcasting Date: Tue, 5 Nov 2002 12:49:25 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1036500565 28883 217.17.192.37 (5 Nov 2002 12:49:25 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Tue, 5 Nov 2002 12:49:25 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:30380 Date: 2002-11-05T12:49:25+00:00 List-Id: * Matthew Baulch wrote: > My question is: How would you do this 'upcasting' if varying > types existed? Obviously the compiler could tell where each > value must go based on their type if only one of their type > was needed in the transition. How does this type of thing work? > (or does the A95 compiler not allow it) procedure t is type Base is tagged null record; type Derivated is new Base with null record; d : Derivated; dc : Base'Class := d; b : Base := Base(d); bc : Base'Class := b; begin -- d := Base (b); -- will not compile d := Derivated (dc); d := Derivated (bc); -- will raised CONSTRAINT_ERROR on run time end t;