comp.lang.ada
 help / color / mirror / Atom feed
* Tagged types (beginner's question) !
@ 2002-08-29  9:39 Vincent DIEMUNSCH
  2002-08-30 13:35 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vincent DIEMUNSCH @ 2002-08-29  9:39 UTC (permalink / raw)


Hello,

I have a simple question concerning tagged types. Suppose that we have :

    type Rationnel is abstract new Ada.Finalization.Controlled with null
record;

    type Fraction is new Rationnel with record
          Num�rateur    : integer;
          D�nominateur : positive;
       end record;

    type Entier is new Fraction with null record;

First Question :
    Can I override the primitive operation "Adjust" of the controlled
type with the following :
        procedure Adjust (F : in out Fraction'Class);
    instead of :
        procedure Adjust( F : in out Fraction);

Second question :
    How can Adjust (F : in out Fraction'Class) return an object of type
Entier instead of Fraction ?
    I tried something like
        F := E; --(with E : Entier)
    and many other more complicated things but I always have the same
error message from GNAT :
        "Dynamiclly tagged expression required".

Looking in the ARM and the user guide from GNAT, I could not get what
this message meant !
Any help would be greatly appreciated. Thanks in advance.

Vincent DIEMUNSCH







^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-30 16:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-29  9:39 Tagged types (beginner's question) ! Vincent DIEMUNSCH
2002-08-30 13:35 ` Ted Dennison
2002-08-30 14:31 ` Pat Rogers
2002-08-30 16:04 ` Stephen Leake

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