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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class Date: Tue, 13 Feb 2018 18:42:11 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <634e9064-33f8-42c0-9032-e630f98c89d4@googlegroups.com> <982639bc-8e7e-4c43-a1ff-cf9fa7c0d0ed@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 13 Feb 2018 17:42:11 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="26ddbe365de3b03fa96a7ed29ac5ba12"; logging-data="2517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/S4vArYv+7q7wMVL87plZY29Vl9Sig9Bc=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 In-Reply-To: <982639bc-8e7e-4c43-a1ff-cf9fa7c0d0ed@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:Em7lj8icXcFYAN+tau6vMYnJAf0= Xref: reader02.eternal-september.org comp.lang.ada:50423 Date: 2018-02-13T18:42:11+01:00 List-Id: On 02/12/2018 10:18 PM, Mehdi Saada wrote: > > I can't believe T_TOKEN'class is as useless... well, in a sense, since the program doesn't know the actual type of TOKEN but only that it's a child of T_TOKEN, no wonder there's some limitations. But I'm surprised there's no mechanism in the language, to tell the program: HEY there ! I'm sure it's T_TOKEN_OPERANDE, so now consider TOKEN as such and let me reach it's OPERANDE component. Given an object V of T_Token'Class, you can do if V in T_Token_Operateur and if V in T_Token_Operateur'Class and then do a conversion to access the components of the extension. You can also compare V'Tag to the tags of the derived types. All of these are frowned on as "not the type-extension way" by aficionados of type extension. -- Jeff Carter "If you don't get the President of the United States on that phone, ... you're going to have to answer to the Coca-Cola Company." Dr. Strangelove 32