comp.lang.ada
 help / color / mirror / Atom feed
From: Vincent DIEMUNSCH <"vincent.diemunsch"@edf.fr@NO.SPAM.PLEASE>
Subject: Tagged types (beginner's question) !
Date: Thu, 29 Aug 2002 11:39:47 +0200
Date: 2002-08-29T09:39:48+00:00	[thread overview]
Message-ID: <akkq54$kcq$1@clnews.edf.fr> (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







             reply	other threads:[~2002-08-29  9:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-29  9:39 Vincent DIEMUNSCH [this message]
2002-08-30 13:35 ` Tagged types (beginner's question) ! Ted Dennison
2002-08-30 14:31 ` Pat Rogers
2002-08-30 16:04 ` Stephen Leake
replies disabled

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