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,FREEMAIL_FROM, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,94d84e4971c0caee X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!k41g2000yqm.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Inheritance with Ada types Date: Mon, 8 Feb 2010 18:57:25 -0800 (PST) Organization: http://groups.google.com Message-ID: <92c90b37-0e9b-49f4-ab37-fbd256ed6f06@k41g2000yqm.googlegroups.com> References: NNTP-Posting-Host: 77.198.58.172 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1265684245 26288 127.0.0.1 (9 Feb 2010 02:57:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 Feb 2010 02:57:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k41g2000yqm.googlegroups.com; posting-host=77.198.58.172; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:9014 Date: 2010-02-08T18:57:25-08:00 List-Id: On 9 f=E9v, 03:16, Bryan wrote: > I created two simple > packges as follows: > > parent.ads: > > with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; > package Parent is > =A0 type Parent is abstract tagged private; > private > =A0 type Parent is abstract tagged > =A0 =A0 record > =A0 =A0 =A0 Name: Unbounded_String; > =A0 =A0 end record; > end Parent; > > derived.ads: > > with Parent; use Parent; > package Derived is > =A0 type Derived is new Parent with private; > private > =A0 type Derived is new Parent with > =A0 =A0 record > =A0 =A0 =A0 Sub_Name: Unbounded_String; > =A0 =A0 end record; > end Derived; Oops : package and type name share the same name and you there are use clause... the use clause is particularly evil here. > $ gnatmake -c parent derived.ads > gcc -c derived.ads > derived.ads:3:23: subtype mark required in this context > derived.ads:3:23: found "Parent" declared at parent.ads:2 The message refer to > package Parent is > derived.ads:5:23: subtype mark required in this context > derived.ads:5:23: found "Parent" declared at parent.ads:2 The same as above Either rename your packages (like Parents and Deriveds ... although the latter is not correct English) or drop the use clause and refer to your Parent ancestor as Parent.Parent instead. By the way, the With clause for Ada.Strings.Unbounded is missing in Derived.ads