comp.lang.ada
 help / color / mirror / Atom feed
From: "Hibou57 (Yannick Duchêne)" <yannick_duchene@yahoo.fr>
Subject: Re: Inheritance with Ada types
Date: Mon, 8 Feb 2010 18:57:25 -0800 (PST)
Date: 2010-02-08T18:57:25-08:00	[thread overview]
Message-ID: <92c90b37-0e9b-49f4-ab37-fbd256ed6f06@k41g2000yqm.googlegroups.com> (raw)
In-Reply-To: ad9aca45-33dc-4765-a998-44a6b57dbe50@q16g2000yqq.googlegroups.com

On 9 fév, 03:16, Bryan <brobinson....@gmail.com> wrote:
> I created two simple
> packges as follows:
>
> parent.ads:
>
> with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
> package Parent is
>   type Parent is abstract tagged private;
> private
>   type Parent is abstract tagged
>     record
>       Name: Unbounded_String;
>     end record;
> end Parent;
>
> derived.ads:
>
> with Parent; use Parent;
> package Derived is
>   type Derived is new Parent with private;
> private
>   type Derived is new Parent with
>     record
>       Sub_Name: Unbounded_String;
>     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



  reply	other threads:[~2010-02-09  2:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09  2:16 Inheritance with Ada types Bryan
2010-02-09  2:57 ` Hibou57 (Yannick Duchêne) [this message]
2010-02-09  9:11   ` Jean-Pierre Rosen
2010-02-09 10:19     ` Hibou57 (Yannick Duchêne)
2010-02-09 11:23       ` Jean-Pierre Rosen
2010-02-10  2:47         ` Randy Brukardt
2010-02-09 10:22     ` Hibou57 (Yannick Duchêne)
2010-02-09 15:08 ` Robert A Duff
2010-02-09 23:39   ` Bryan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox