comp.lang.ada
 help / color / mirror / Atom feed
From: mab@dst17.wdl.loral.com (Mark A Biggar)
Subject: Re: Alright, now for an Ada '95 question.
Date: 1996/08/16
Date: 1996-08-16T00:00:00+00:00	[thread overview]
Message-ID: <4v24n3$3sf@wdl1.wdl.lmco.com> (raw)
In-Reply-To: 3213D46A.2404@ghgcorp.com


In article <3213D46A.2404@ghgcorp.com> Mike Bishop <mbishop@ghgcorp.com> writes:
>Tom Di Sessa wrote:
>> First of all, I want to thank the people who responded to my first(and
>> rather unpolite) post.  Thank you.
>> In Java, I am able to do this comparison:
>> (target is of Class(Type) Component, and Class Button is is derived from
>> Component)
>> if (target instanceof Button) {...}
>> Now, is there a way to do this comparison in Ada '95, if target was of
>> type Component'Class and Button was a derived type from Component?
>The following comparisons can be done in Ada 95:
>if target in Button then ...
>if target in Component'class then ...
>I don't know of a way to compare the types Button and Component in order
>to determine if Button is derived from Component. That doesn't mean that
>there is no way to do it, only that I don't know how to do it.

The only way I can think of is to create a dummy object and use that:

declare
	target: Button;
begin
	if target in Component'Class then
		-- Button is derived from or subtype of Component
	end if;
end;

--
Mark Biggar
mab@wdl.lmco.com








  reply	other threads:[~1996-08-16  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-15  0:00 Alright, now for an Ada '95 question Tom Di Sessa
1996-08-15  0:00 ` William W Pritchett
1996-08-15  0:00 ` Mike Bishop
1996-08-16  0:00   ` Mark A Biggar [this message]
1996-08-16  0:00   ` Jon S Anthony
1996-08-16  0:00 ` Tucker Taft
1996-08-16  0:00 ` Jon S Anthony
replies disabled

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