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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a3c2ec05bff4ab48 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada: Inheritance of generics Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1d2swajw7rsue$.ftt2098a7wvt$.dlg@40tude.net> Date: Mon, 2 Jun 2008 17:09:44 +0200 Message-ID: NNTP-Posting-Date: 02 Jun 2008 17:09:44 CEST NNTP-Posting-Host: 267b7a95.newsspool3.arcor-online.net X-Trace: DXC=3UbOLN6iT=085[]]\]T081McF=Q^Z^V384Fo<]lROoR18kF7enW;^6ZC`4IXm65S@:3>?kaclZZIoKh< X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:523 Date: 2008-06-02T17:09:44+02:00 List-Id: On Mon, 02 Jun 2008 16:17:48 +0200, Dennis Hoppe wrote: > Dmitry A. Kazakov wrote: >> On Mon, 02 Jun 2008 15:39:05 +0200, Dennis Hoppe wrote: >> >>> -- child unit >>> generic >>> -- omitted >>> package Generic_Child is >>> type Object is new Generic_Parent.Object with private; >> >> This is illegal. Generic_Parent is a generic unit, you cannot refer to >> anything within it without either instantiation of, or else from a generic >> child unit of. Generic_Child is not a child package of Generic_Parent. > > Hmm...this line is really a left over from simple inheritance without > generic unit, but the Ada compiler does not complain about it. Then get another compile. The following: generic type Modular_Type is mod <>; package Generic_Parent is type Object is abstract tagged limited null record; function Example return Integer; end Generic_Parent; with Generic_Parent; generic -- omitted package Generic_Child is type Object is new Generic_Parent.Object with private; function Example return Integer; end Generic_Child; compiled by GNAT ends up with:: generic_child.ads:5:23: invalid prefix in selected component "Generic_Parent" -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de