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-Thread: 103376,9491b94351596175 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.posted.plusnet!news.posted.plusnet.POSTED!not-for-mail NNTP-Posting-Date: Fri, 06 Feb 2009 08:08:15 -0600 Newsgroups: comp.lang.ada Followup-To: comp.lang.ada From: Robert_Matthews Subject: Re: A problem with "interface" Date: Fri, 06 Feb 2009 14:08:17 +0000 References: User-Agent: KNode/0.99.01 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Message-ID: X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-Pd9CeJc1F/lFxWVHYV12BUgARr5ttQOwFFe5Lxeno3c8+1DnBMO13oCZUp7fHPcv2MOJYZX6Ft9Wsd5!nF7l5X9HzcjhirxJHY56ZHalsmAXvoY//SwheMd7mBV1nlk+vPWPHDtG2EEjSuk1RGNU23HXbQAV!z90LBqdpNg== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Xref: g2news2.google.com comp.lang.ada:4548 Date: 2009-02-06T14:08:17+00:00 List-Id: Adam Beneschan wrote: > You're making a mistake, but I'm hesitant to call it a "dumb" one. > When you declare Client_A, the package implicitly declares inherited > operations, which are inherited from primitive operations of Int.A. > One of those is Client_P, and so you'll get this *implicit* > declaration; > > procedure Client_P (Param1 : Client_A; Param2 : Int.B'Class); > > Since Client_A is derived from Int.A, all uses of "A" in the profile > are replaced by Client_A. But "B" isn't touched. > > Note that nothing is inherited when you declare Client_B. Client_P is > a primitive operation of Int.A but *not* of Int.B (since its parameter > is B'Class, not B). > > When you declare an overriding procedure, the procedure has to > override something that is implicitly declared. The only implicitly > declared procedure is the one I showed above; its second parameter has > type Int.B'Class, not Client_B'Class, and therefore the procedure you > declared can't override it. > > The way to do this is to declare your procedure with "Param2 : > Int.B'Class"; then in the body of Client_P, you can say something like > > if Param2 not in Client_B'Class then > raise with "Wrong client type"; > end if; > > -- Adam Many thanks for putting me right on this - though on a second look I see I made yet another dumb mistake: in the package "Client" the procedure should be called "P" rather than "Client_P". Clearly senility is taking its toll! Robert