comp.lang.ada
 help / color / mirror / Atom feed
* Should the compiler accept this?
@ 2001-10-10 16:57 Stephen Cole
  2001-10-10 17:11 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Cole @ 2001-10-10 16:57 UTC (permalink / 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()?








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

end of thread, other threads:[~2001-10-11  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-10 16:57 Should the compiler accept this? Stephen Cole
2001-10-10 17:11 ` Ted Dennison
2001-10-10 17:12 ` Ed Falis
2001-10-11  8:48 ` Stephen Cole

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