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,c9a5d6b3975624e1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-08 11:00:36 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: OO in Ada Date: Tue, 8 Oct 2002 13:58:56 -0400 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3da2aafd.7023559@news.demon.co.uk> <3DA31301.80506@cogeco.ca> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:29598 Date: 2002-10-08T13:58:56-04:00 List-Id: "Warren W. Gay VE3WWG" wrote in message news:3DA31301.80506@cogeco.ca... > > I believe that the problem referred to here is simply one > of a visibility. Either a 'use' or a fully qualified call is > required. No. Primitive operations for a type are inherited during a derivation (it doesn't matter what kind of type the parent is), and are therefore "implicitly declared" immediately following the declaration of the derived type. For example: package P is type T is range 0 .. 10; procedure Op (O : in T); end: with P; package Q is type NT is new P.T; end; There is an operation called Op implicitly declared for Q.NT. To call it you do NOT have to with P. For example: declare use Q; O : NT; begin Op (O); end; Op does NOT need any qualification, because it's already declared in Q, and the operations in Q (even implicitly declared operations) are directly visible (here, because use Q). > If I understand correctly, you're saying you have > some parent package "Pen", and a child package "Thick_Pen", > and you use the package as in: > > use Pen.Thick_Pen; > ... > Draw(...); -- Compile error because Draw is defined in Pen The Draw operation that takes a thick pen type is (implicitly) declared in package Thick_Pen. There is NO compile error. It doesn't even matter whether package Think_Pen is a child of Pen. Primitive operations of a type are inherited during a derivation. That's what it means for an operation to be "primitive." > This is solved either by doing something like: > > use Pen, Pen.Thick_Pen; > ... > Draw(...); -- OK now, because Pen.Draw is visible. This will NOT compile, because Pen.Draw takes Pen_Type, not Thick_Pen_Type. > or qualifying by your call as in: > > use Pen.Thick_Pen; > ... > Pen.Draw(...); No. This won't compile either. You need to say: Pen.Thick_Pen.Draw(...);