comp.lang.ada
 help / color / mirror / Atom feed
* question on objects/package relationships
@ 2000-12-12  0:51 HDhil
  2000-12-12  2:44 ` Marin David Condic
  0 siblings, 1 reply; 2+ messages in thread
From: HDhil @ 2000-12-12  0:51 UTC (permalink / raw)


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






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question on objects/package relationships
  2000-12-12  0:51 question on objects/package relationships HDhil
@ 2000-12-12  2:44 ` Marin David Condic
  0 siblings, 0 replies; 2+ messages in thread
From: Marin David Condic @ 2000-12-12  2:44 UTC (permalink / raw)


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
======================================================================





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-12-12  2:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-12  0:51 question on objects/package relationships HDhil
2000-12-12  2:44 ` Marin David Condic

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