comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Why can't I override these functions?
Date: 08 May 2004 12:34:21 +0100
Date: 2004-05-08T12:34:21+01:00	[thread overview]
Message-ID: <x7vfzabw3sy.fsf@smaug.pushface.org> (raw)
In-Reply-To: 7BRmc.58437$mU6.237336@newsb.telia.net

The compiler should probably have said something to point you at:

   AARM 3.9.3(10), For an abstract type declared in a visible part, an
   abstract primitive subprogram shall not be declared in the private
   part, unless it is overriding an abstract subprogram implicitly
   declared in the visible part. For a tagged type declared in a
   visible part, a primitive function with a controlling result shall
   not be declared in the private part, unless it is overriding a
   function implicitly declared in the visible part.

   Reason: The ``visible part'' could be that of a package or a
   generic package. This rule is needed because a non-abstract type
   extension declared outside the package would not know about any
   abstract primitive subprograms or primitive functions with
   controlling results declared in the private part, and wouldn't know
   that they need to be overridden with non-abstract subprograms. The
   rule applies to a tagged record type or record extension declared
   in a visible part, just as to a tagged private type or private
   extension. The rule applies to explicitly and implicitly declared
   abstract subprograms:

In an equivalent place in the Booch Components, I make the subprogram
concrete and say

   function Item_At (C : Container; Index : Positive) return Item_Ptr is
   begin
      raise Should_Have_Been_Overridden;
      return null;
   end Item_At;

-- 
Simon Wright                               100% Ada, no bugs.



  parent reply	other threads:[~2004-05-08 11:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-07 10:43 Why can't I override these functions? Björn Persson
2004-05-07 17:15 ` Jim Rogers
2004-05-07 18:15   ` Björn Persson
2004-05-07 18:42 ` Georg Bauhaus
2004-05-07 19:38   ` Björn Persson
2004-05-08  6:15     ` Martin Krischik
2004-05-09 12:42       ` Björn Persson
2004-05-08 11:34     ` Simon Wright [this message]
2004-05-09 12:38       ` Björn Persson
2004-05-10  5:43         ` Simon Wright
2004-05-10 11:49 ` Martin Dowie
2004-05-10 12:13   ` Björn Persson
2004-05-13  7:23 ` Björn Persson
replies disabled

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