comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Package Hierarchy and Private functions
Date: Wed, 18 Mar 2009 10:19:13 -0400
Date: 2009-03-18T10:19:13-04:00	[thread overview]
Message-ID: <wccd4ce29su.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: a24dfb20-e831-4d0a-8db9-2a890e89285b@p11g2000yqe.googlegroups.com

"RasikaSrinivasan@gmail.com" <RasikaSrinivasan@gmail.com> writes:

> Supposing we have 2 packages like :
>
> package P is
>   type Pvt_T is private ;
> private
>   type Pvt_T is ... ;
>   procedure Pvt_Proc(p : in out Pvt_T) ;
> end P ;
>
> ---------------------
>
> package P.C is
> ....
> end P.C ;
>
> ------------------
>
> Is there a way for P.C to access Pvt_Proc (instead of making it
> public).

The contents of P's private part are visible in the private part and the
body of P.C.  It's similar to putting a package C nested inside P,
but not exactly the same.

If you make P.C into a private child package:

private package P.C is
...
end P.C ;

then the contents of P's private part are visible in ALL of P.C,
including its visible part.

> I guess this may be analogous to protected in C++?

Yeah, sort of.

- Bob



      parent reply	other threads:[~2009-03-18 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18 12:22 Package Hierarchy and Private functions RasikaSrinivasan
2009-03-18 12:42 ` Maciej Sobczak
2009-03-18 12:56   ` Srini -
2009-03-18 14:19 ` Robert A Duff [this message]
replies disabled

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