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.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.36.29.216 with SMTP id 207mr375318itj.55.1518485560975; Mon, 12 Feb 2018 17:32:40 -0800 (PST) X-Received: by 10.157.32.3 with SMTP id n3mr504601ota.12.1518485560704; Mon, 12 Feb 2018 17:32:40 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!feed.usenet.farm!feeder4.usenet.farm!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!o66no1178300ita.0!news-out.google.com!m16ni2657itm.0!nntp.google.com!o66no1178298ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 12 Feb 2018 17:32:40 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.154.189.221; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 82.154.189.221 References: <634e9064-33f8-42c0-9032-e630f98c89d4@googlegroups.com> <5f36f0ae-87ed-4482-9766-561b63b1d343@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <58302fb3-4b2d-4651-82ca-1efa0b2de8f3@googlegroups.com> Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Tue, 13 Feb 2018 01:32:40 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:50407 Date: 2018-02-12T17:32:40-08:00 List-Id: I used to think that conversion from a class-wide type to a child type need t ever be explicit, I was wrong, and it's safer that way of course. It's better to use as little redispatching or dynamic whatever as possible. I did: ELEMENT : Character renames STRING_VECTOR(Current_Index); case ELEMENT is when '(' => V_LOCAL (I) := new T_TOKEN_PARENTHESE'(La_Parenthese => '('); when ')' => V_LOCAL (I) := new T_TOKEN_PARENTHESE'(La_Parenthese => ')'); when ';' => V_LOCAL (I) := new T_TOKEN_TERMINATEUR'(Le_Terminateur => ';'); when '+' | '-' | '*' | '/' => V_LOCAL (I) := new T_Token_Operateur'(L_Operateur => T_Operateur'Value (STRING'(1 => ELEMENT))); The last error (hope none more will pop up !) is PUSH (PILE, To_Token(TEMP_PRIORITE.L_Operateur)'Access); considered that type PTR_TOKEN_CLASS is access constant T_Token'Class; package P_PILE_1 is new P_Pile_4 (T_Elem => PTR_TOKEN_CLASS, Max_Pile => V_ENTREE'Length); use P_PILE_1, P_Pile_2; PILE : P_PILE_1.T_Pile(50); I got "prefix of "Access" attribute must be aliased", which is logical, but how do I aliase the result of a conversion ?