From: Jean-Marc Bourguet <jbourguet@free.fr>
Subject: Re: Simple Question 3
Date: Sun, 14 Oct 2001 09:51:04 +0200
Date: 2001-10-14T09:54:12+02:00 [thread overview]
Message-ID: <3BC943E8.DB044D8D@free.fr> (raw)
In-Reply-To: 9q6k2r$p8g$1@trog.dera.gov.uk
Stephen Cole wrote:
>
> I would have thought that the compiler should just through the assignment X
> := Unit() out, because it does not statically match. I do not see why the
> compiler has the right to demand you write a Unit() function for the derived
> type. Is there a deeper reason why it does?
I think you did not understood what you did. You created Unit as a primitive
operations of a tagged type which returns a value of this type. The rules of
Ada imply that all non abstract derived types have to override the definition
of this function.
You probably didn't want to declare a primitive operation. There are two
solutions: return a classwide type (so it will not return a value of the
type) or declare the function in another package (so it will not be a
primitive operation).
Declaring it in a nested package and providing a renaming will give you what
you though you had declared .
-- Jean-Marc
next prev parent reply other threads:[~2001-10-14 7:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-11 14:28 Simple Question 3 Stephen Cole
2001-10-11 22:41 ` tmoran
2001-10-12 11:33 ` Stephen Cole
2001-10-12 17:03 ` tmoran
2001-10-14 7:51 ` Jean-Marc Bourguet [this message]
2001-10-12 13:33 ` David C. Hoos
2001-10-14 18:53 ` Stephen Cole
2001-10-14 20:45 ` Vincent Marciante
2001-10-14 21:00 ` Jeffrey Carter
2001-10-14 22:08 ` Stephen Cole
2001-10-15 6:26 ` Jeffrey Carter
2001-10-14 21:15 ` Primitive operations and derived types (Was: Simple Question 3) Jacob Sparre Andersen
2001-10-14 21:42 ` Simple Question 3 tmoran
2001-10-14 22:30 ` Stephen Cole
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox