comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Dowie <martin.dowie@btopenworld.com>
Subject: Re: Base'Class is instance of Der1?
Date: Sat, 8 Jan 2005 14:25:43 +0000 (UTC)
Date: 2005-01-08T14:25:43+00:00	[thread overview]
Message-ID: <croqh7$4k5$1@titan.btinternet.com> (raw)
In-Reply-To: <2132851.tZm0acYkSN@linux1.krischik.com>

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



  reply	other threads:[~2005-01-08 14:25 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 [this message]
2005-01-08 15:00     ` Martin Krischik
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