comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class
Date: Mon, 12 Feb 2018 18:44:59 +0100
Date: 2018-02-12T18:44:59+01:00	[thread overview]
Message-ID: <p5sjqs$gv4$1@dont-email.me> (raw)
In-Reply-To: <634e9064-33f8-42c0-9032-e630f98c89d4@googlegroups.com>

On 02/12/2018 05:29 PM, Mehdi Saada wrote:
> I'm learning POO.

What you're learning is type extension. By far most of the questions on here 
where the language doesn't do what is expected deal with anonymous access types 
and type extension. That's because they're parts of the language that are 
counter-intuitive and confusing. You're doing both. Don't do that, and things 
will be much easier.

But if you're taking a course and have to mess with type extension, at least you 
should avoid the access types.

> I have trouble, indeed. Please look at this:
> 
> if GET_ELEM (TOKEN_COURANT) = '(' then VALIDE;
> -->
> expected type "T_Token_Operateur" defined
> Found type T_TOKEN'Class
> 
> function Get_Elem (Token : in T_Token_Operateur) return T_Operateur is (Token.L_Operateur);

That clearly takes a T_Token_Operateur.

> function TOKEN_COURANT return T_TOKEN'Class is

and that clearly return T_Token'Class, just as the error msg said.

It seems you have 3 choices: Make Get_Elem take T_Token'Class, make 
Token_Courant return T_Token_Operateur, or convert the result of Token_Courant 
to T_Token_Operateur.

-- 
Jeff Carter
"You a big nose have it."
Never Give a Sucker an Even Break
107


  reply	other threads:[~2018-02-12 17:44 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 16:29 troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class Mehdi Saada
2018-02-12 17:44 ` Jeffrey R. Carter [this message]
2018-02-12 18:17   ` Mehdi Saada
2018-02-12 18:24     ` Dmitry A. Kazakov
2018-02-12 18:42       ` Simon Wright
2018-02-12 20:25     ` Jeffrey R. Carter
2018-02-12 21:18       ` Mehdi Saada
2018-02-12 22:40         ` Simon Wright
2018-02-12 23:12           ` Mehdi Saada
2018-02-13  8:00         ` Stephen Leake
2018-02-13 17:42         ` Jeffrey R. Carter
2018-02-13 17:56           ` Dmitry A. Kazakov
2018-02-12 21:19       ` Mehdi Saada
2018-02-12 18:40   ` Simon Wright
2018-02-12 21:39 ` Mehdi Saada
2018-02-12 21:43 ` Mehdi Saada
2018-02-12 22:22   ` Mehdi Saada
2018-02-13 17:46     ` Jeffrey R. Carter
2018-02-13 20:19       ` Mehdi Saada
2018-02-13 21:24         ` Bojan Bozovic
2018-02-13 23:03           ` Mehdi Saada
2018-02-13 23:03             ` Mehdi Saada
2018-02-14  7:00               ` Bojan Bozovic
2018-02-14 12:04                 ` Mehdi Saada
2018-02-16 23:40                   ` Mehdi Saada
2018-02-17  1:13                     ` Mehdi Saada
2018-02-13  0:01 ` Mehdi Saada
2018-02-13  0:42   ` Mehdi Saada
2018-02-13  1:32     ` Mehdi Saada
2018-02-13  4:16       ` Bojan Bozovic
2018-02-13 11:28       ` Simon Wright
2018-02-13 12:03         ` Mehdi Saada
2018-02-13 13:25         ` Dmitry A. Kazakov
2018-02-19 18:10 ` Mehdi Saada
2018-02-19 18:16   ` Simon Clubley
replies disabled

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