comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: How to test object hierarchy
Date: 19 Dec 2003 18:26:25 -0500
Date: 2003-12-19T18:26:25-05:00	[thread overview]
Message-ID: <wcck74sv17i.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1071844528.57052@master.nyc.kbcfp.com

Hyman Rosen <hyrosen@mail.com> writes:

> Dmitry A. Kazakov wrote:
> > You have to override Test_Hierarchy for each new type
> 
> Which brings a question to my non Ada-knowing mind.
> I know that for a subprogram to be dispatching, it
> must be defined in the same package (or immediately
> after?) as the tagged type upon which it dispatches.

It must defined in the same package *spec* (visible part or private
part).

One obscure point is that if you override an inherited subprogram, it is
dispatching.  It has to be declared in the same declarative region in
that case.

> Can an instantiation of a generic be dispatching in
> this way?

Yes, it can be instance.  It can also be a renaming.

>... Could I do (pardon the syntax errors)
>      procedure Test_Hierarchy is new
> 	Generic_Test_Hierarchy(Type1=>Derived_Object);
> rather than copy the code each time?

I didn't follow the entire discussion, but yes, I think that could work.

- Bob



  parent reply	other threads:[~2003-12-19 23:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-18 18:24 How to test object hierarchy Pierre Favier
2003-12-19  0:15 ` Stephen Leake
2003-12-19  7:45   ` Pierre Favier
2003-12-19 10:53 ` Dmitry A. Kazakov
2003-12-19 14:35   ` Hyman Rosen
2003-12-19 17:07     ` Dmitry A. Kazakov
2003-12-19 23:26     ` Robert A Duff [this message]
2003-12-20 18:20       ` Robert I. Eachus
2003-12-19 17:25   ` Georg Bauhaus
2003-12-20 11:13     ` Dmitry A. Kazakov
2003-12-21  4:34       ` Georg Bauhaus
2003-12-21 13:43         ` Dmitry A. Kazakov
2003-12-21 19:58           ` Dmytry Lavrov
2003-12-22  1:19             ` Robert I. Eachus
2003-12-22 10:09               ` Dmitry A. Kazakov
2003-12-22 17:33                 ` Robert I. Eachus
2003-12-23 10:49                   ` Dmitry A. Kazakov
2003-12-22 10:05             ` Dmitry A. Kazakov
2003-12-19 17:24 ` Nick Roberts
replies disabled

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