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,a3c2ec05bff4ab48 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!eweka.nl!lightspeed.eweka.nl!npeer.de.kpn-eurorings.net!npeer-ng1.kpn.DE!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 02 Jun 2008 16:30:29 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada: Inheritance of generics References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <48440405$0$6557$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 02 Jun 2008 16:30:29 CEST NNTP-Posting-Host: f7afe3aa.newsspool3.arcor-online.net X-Trace: DXC=<275]Tj^j7H[6=1B@oB@@@McF=Q^Z^V3H4Fo<]lROoRA8kFJLh>_cHTX3jMi=iInkQ9nUE X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:521 Date: 2008-06-02T16:30:29+02:00 List-Id: Dennis Hoppe schrieb: > Hi, > > I managed to implement a generic parent class and create a generic unit, > which is a child of the first one. I wonder, why I have access to > procedures and functions of the parent class, if I am "within" the child > unit, but if I am "outside", the compiler complains that no selector for > a specified function exists. Do you mean a parent type and a derived type which happen to be declared in package templates? The name "generic child package" has a meaning in Ada that does not necessarily have something to do with types. Just in case you are used to thinking in C++, a package is not always the same as a class. For example, you can have two types within the same package. Only types, i.e. things declared using the resered word "type", can derive from other types. Likewise, a package instance is made from a generic package which acts as a template for packages. But packages are not types. So this does not work: package Child is new Parent.Object; function Example return Integer; is not associated with type Object; its profile does not mention Object. Function Example is somewhat like a static member function in C++. -- Georg