comp.lang.ada
 help / color / mirror / Atom feed
From: "Stephen Cole" <s_k_cole@yahoo.com>
Subject: Should the compiler accept this?
Date: Wed, 10 Oct 2001 17:57:19 +0100
Date: 2001-10-10T17:57:19+01:00	[thread overview]
Message-ID: <9q1uah$6ir$1@trog.dera.gov.uk> (raw)

Hi

Simple question 2......

package MyTstTypes is
   type MyRcd is abstract tagged
      record
         a: Integer;
         b: Float;
      end record;

   function Hello(A: MyRcd) return Integer is abstract;

   type MyNewRcd is new MyRcd with
      record
         c: Integer;
      end record;

   function Hello(A: MyNewRcd) return Integer;

   type MyNewRcd2 is new MyNewRcd with
      record
         d: Float;
      end record;

   function Add(A: MyRcd'class) return Integer;

end MyTstTypes;

The compiler is not complaining about it, but according to the rules of Ada
and not just what the compiler accepts, should I be defining a function
Hello() for derived type MyNewRcd2?? Or can I always assume that the Hello()
defined for type MyNewRcd will actually catch calls to Hello() made with an
actual MyNewRcd2 type variable passed as a parameter to Add()?








             reply	other threads:[~2001-10-10 16:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-10 16:57 Stephen Cole [this message]
2001-10-10 17:11 ` Should the compiler accept this? Ted Dennison
2001-10-10 17:12 ` Ed Falis
2001-10-11  8:48 ` 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