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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,990196a3d5e5eb5e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-08 21:39:15 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!news.supernews.com!not-for-mail From: James Ross Newsgroups: comp.lang.ada Subject: Re: Child packages question Date: Mon, 08 Apr 2002 22:39:33 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: X-Newsreader: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:22255 Date: 2002-04-08T22:39:33-06:00 List-Id: 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 :-)