comp.lang.ada
 help / color / mirror / Atom feed
From: Marin David Condic <mcondic.nospam@acm.org>
Subject: Re: question on objects/package relationships
Date: Mon, 11 Dec 2000 21:44:03 -0500
Date: 2000-12-12T02:43:31+00:00	[thread overview]
Message-ID: <3A3590F3.E890B10A@acm.org> (raw)
In-Reply-To: 20001211195143.22219.00004738@ng-da1.aol.com

It depends a little on what you are trying to accomplish and exactly how
you define your A and B objects. It would be legal to do something like
this:

package X is
    A : Integer ;
end X ;

package Y is
    B : Integer ;
    function What_Is_A return Integer ;
end Y ;

with X ;
package body Y is
    function What_Is_A return Integer is
    begin
        return X.A ;
    end What_Is_A ;
end Y ;

Note that if A gets defined in the private part of X, you could not do
this. As long as you have visibility it should be just fine. The
compiler will definitely tell you if you don't have visibility of A.

Hope this answers your question.

MDC

HDhil wrote:

> Another newbie question. If i define object A in Ada using
> a package specification, and then have to define another
> another object B in a separate specification...
>
> ...is it possible i can have a function that uses object A
> (or returns object A) within the package specifying object B?
> If so, what's the general methodt for doing that?
>
> Many thanks,
> Harry

--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/
Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at:  http://www.mcondic.com/

    "Giving money and power to Government is like giving whiskey
    and car keys to teenage boys."

        --   P. J. O'Rourke
======================================================================





      reply	other threads:[~2000-12-12  2:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-12  0:51 question on objects/package relationships HDhil
2000-12-12  2:44 ` Marin David Condic [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