From: James Ross <rem.jr@rem.webross.com>
Subject: Re: Child packages question
Date: Mon, 08 Apr 2002 22:39:33 -0600
Date: 2002-04-08T22:39:33-06:00 [thread overview]
Message-ID: <q8r4bu4qs5ven1s45se6ulsuo6f5tmhav4@4ax.com> (raw)
In-Reply-To: mailman.1018322344.15608.comp.lang.ada@ada.eu.org
sk wrote:
>Hi,
Thanks sk! and others. I ditto the nice example comment. That is
precisely the answer. When I first looked at it, I thought hey wait a
minute, he's done nothing special there... Then I noticed the missing
piece of the puzzle: starting the child package with "private
package". I was certain there was a way, and was almost certain it
was private ... something, but I thought some declaration either in
the spec or body of Car...
Oh yeah, I like Ada a bit more now.
If I am not mistaken, it appears that Ada 95 Problem Solving and
Program Design (2and Edition) never mentions it.
JR
>-----------------------------------------------------
>-- file1 : car.ads
>package Car is
>
> procedure Accelerate;
>
>end Car;
>
>-----------------------------------------------------
>-- file2 : car.ads
>with Car.Engine;
>
>package body Car is
>
> procedure Accelerate is
> begin
> Car.Engine.Pump_More_Gas;
> end Accelerate;
>
>end Car;
>
>-----------------------------------------------------
>-- file2 : car-engine.ads
>private package Car.Engine is
>
> procedure Pump_More_Gas;
>
>end Car.Engine;
>
>-----------------------------------------------------
>-- file2 : car-engine.adb
>package body Car.Engine is
>
> procedure Pump_More_Gas is
> begin
> null;
> end Pump_More_Gas;
>
>end Car.Engine;
>
>-----------------------------------------------------
>-- file2 : Mario_Andretti.adb
>with Car;
>--with Car.Engine;
>
>procedure Mario_Andretti is
>
>begin
> Car.Accelerate;
>
>-- Car.Engine.Accelerate;
>
>end Mario_Andretti;
>-----------------------------------------------------
>
>Try uncommenting :
>"with Car.Engine"
>"Car.Engine.Accelerate"
>
>Compiler should complain :-)
next prev parent reply other threads:[~2002-04-09 4:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-09 1:33 Child packages question James Ross
2002-04-09 2:17 ` sk
2002-04-09 4:39 ` James Ross [this message]
2002-04-09 4:40 ` sk
2002-04-09 6:37 ` Ingo Marks
2002-04-09 3:17 ` Pat Rogers
2002-04-09 3:58 ` Randy Brukardt
2002-04-09 8:28 ` tmoran
2002-04-09 15:11 ` Ted Dennison
2002-04-10 23:02 ` Randy Brukardt
[not found] <3CB24F38.2D03C71A@myob.com>
2002-04-09 2:54 ` Steven Deller
[not found] <000101c1df71$eb7d9920$2137e5c0@rational.com>
2002-04-09 3:22 ` sk
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox