comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class
Date: Wed, 14 Feb 2018 04:04:20 -0800 (PST)
Date: 2018-02-14T04:04:20-08:00	[thread overview]
Message-ID: <fae43e54-3949-4ab8-8708-554888f7de63@googlegroups.com> (raw)
In-Reply-To: <66ff85f0-0550-4568-afe9-49eb85e6ab55@googlegroups.com>

Ah... Of course, I haven't mastered that part.
For instance, I'm not sure how many times in
	 if TOKEN_COURANT in T_TOKEN_OPERANDE then SUITE;
	 elsif TOKEN_COURANT in T_TOKEN_PARENTHESE then
	    if GET_ELEM (T_Token_Parenthese (TOKEN_COURANT)) = '(' then VALIDE;
	    else SUITE; end if;
	 else OK := FALSE;
TOKEN_COURANT is called. Only once is what I would like, but I code it only assuming, without knowing for sure...

Each subprogram being meant to test one character at once, I wrote that:
procedure SUITE;
procedure SUITE is
   TOKEN_COURANT : T_TOKEN'Class := TOKEN_COURANT_APPEL;
begin
  if TOKEN_COURANT in T_Token_Operateur then VALIDE;
  else OK := FALSE;
  end if;
end SUITE;

But that's not the problem (since it still fails). The recursive design was given by the teacher, and part of the exercice's interest is to teach us that. Eventhough, I find these designs horrible to read and to be avoided at (almost) all costs.

  reply	other threads:[~2018-02-14 12:04 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
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 [this message]
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