comp.lang.ada
 help / color / mirror / Atom feed
From: johnherro@aol.com (John Herro)
Subject: Re: Scope of variables in package ??
Date: 1996/06/28
Date: 1996-06-28T00:00:00+00:00	[thread overview]
Message-ID: <4qvu8s$imj@newsbf02.news.aol.com> (raw)
In-Reply-To: 31D1A979.103B@vzcorp.com

"Sandeep V. Kharkar" <skharkar@vzcorp.com> writes:
> If a function/procedure is defined as SEPARATE,i.e.,
> implementation outside the PACKAGE BODY, can it still see
> variables defined inside the PACKAGE BODY but
> not in the PACKAGE SPECIFICATION  ??
     If I understand your question correctly, it can see variables defined
in the package body (above the function/procedure) AND variables defined
in the package specification.  For example,
package P is
   I : Integer;
   procedure Test;
end P;
package body P is
   F : Float;
   procedure Test is separate;
end P;
separate (P)
procedure Test is
   ... -- Test can see both I and F.
end Test;
     There's much, much more to the subject.  For example programs outside
package P that "with" the package can see I but not F.  This feature of
Ada, called information hiding, can help contain the effects of certain
changes to your program, so that they don't impact other parts of the
program.  Private package parts, which I haven't discussed here, improve
information hiding even further.  For more information, download my Ada
Tutor program, available at the Web and FTP sites below my signature.  I
hope this helps.
- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor





      parent reply	other threads:[~1996-06-28  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <31D1A979.103B@vzcorp.com>
1996-06-27  0:00 ` Scope of variables in package ?? Mark A Biggar
1996-06-27  0:00 ` Tucker Taft
1996-06-28  0:00 ` John Herro [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