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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc656fd0afa65ff3 X-Google-Attributes: gid103376,public From: mab@dst17.wdl.loral.com (Mark A Biggar) Subject: Re: Alright, now for an Ada '95 question. Date: 1996/08/16 Message-ID: <4v24n3$3sf@wdl1.wdl.lmco.com>#1/1 X-Deja-AN: 174675547 references: <32134421.31CF@wpllabs.com> <3213D46A.2404@ghgcorp.com> organization: Loral Western Development Labs newsgroups: comp.lang.ada Date: 1996-08-16T00:00:00+00:00 List-Id: In article <3213D46A.2404@ghgcorp.com> Mike Bishop 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