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-Thread: 103376,f34a46f284c01816 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!newsfeed.stueberl.de!newsr1.ipcore.viaginterkom.de!news-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: Martin Dowie Newsgroups: comp.lang.ada Subject: Re: Base'Class is instance of Der1? Date: Sat, 8 Jan 2005 14:25:43 +0000 (UTC) Organization: BT Openworld Message-ID: References: <1105185677.254129.171840@c13g2000cwb.googlegroups.com> <2132851.tZm0acYkSN@linux1.krischik.com> NNTP-Posting-Host: host81-152-56-142.range81-152.btcentralplus.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: titan.btinternet.com 1105194343 4741 81.152.56.142 (8 Jan 2005 14:25:43 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Sat, 8 Jan 2005 14:25:43 +0000 (UTC) In-Reply-To: <2132851.tZm0acYkSN@linux1.krischik.com> X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) Xref: g2news1.google.com comp.lang.ada:7568 Date: 2005-01-08T14:25:43+00:00 List-Id: Martin Krischik wrote: > Hi R > > R wrote: > > >>Hello. >> >>I've got function which has a parameter of type Base'Class. >> >>well I have 3 derived tagged records and depending of what exactly is >>the parameter I have to cast it to a proper function. > > > Maybe you want a view rename instead of a cast: > > http://en.wikibooks.org/wiki/Programming:Ada:Subtypes#Rename_View Surely: type Parent_Type is tagged null record; type Child_Type is tagged null record; Child_Instance : Child_Type; Parent_View : Parent_Type'Class renames Parent_Type'Class (Child_Type); Should be: type Parent_Type is tagged null record; type Child_Type is new Parent_Type with null record; Child_Instance : Child_Type; Parent_View : Parent_Type'Class renames Parent_Type'Class (Child_Instance); Cheers -- Martin