From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,760a0492b97ae06e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-19 15:26:26 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: How to test object hierarchy Date: 19 Dec 2003 18:26:25 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <93172edb.0312181024.9a536b2@posting.google.com> <1071844528.57052@master.nyc.kbcfp.com> NNTP-Posting-Host: pip1-5.std.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1071876385 20283 192.74.137.185 (19 Dec 2003 23:26:25 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 19 Dec 2003 23:26:25 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:3592 Date: 2003-12-19T18:26:25-05:00 List-Id: Hyman Rosen 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