comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <martin@krischik.com>
Subject: Re: Base'Class is instance of Der1?
Date: Sat, 08 Jan 2005 16:00:06 +0100
Date: 2005-01-08T16:00:06+01:00	[thread overview]
Message-ID: <5342507.zygovnidUI@linux1.krischik.com> (raw)
In-Reply-To: croqh7$4k5$1@titan.btinternet.com

Martin Dowie wrote:

> 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);

Ups, you are right! But why did you not hit the [edit] button and corrected
it?

Martin
-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



  reply	other threads:[~2005-01-08 15:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-08 12:01 Base'Class is instance of Der1? R
2005-01-08 12:38 ` Martin Krischik
2005-01-08 14:25   ` Martin Dowie
2005-01-08 15:00     ` Martin Krischik [this message]
2005-01-10  9:29       ` Martin Dowie
2005-01-08 12:51 ` Ludovic Brenta
2005-01-08 14:20 ` Dreni
replies disabled

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