comp.lang.ada
 help / color / mirror / Atom feed
From: caldwell@typhoon.seas.ucla.edu (Andrew E. Caldwell)
Subject: don't understand packages vs. objects/classes
Date: Sun, 27 Nov 1994 04:42:06 GMT
Date: 1994-11-27T04:42:06+00:00	[thread overview]
Message-ID: <Czwt26.G0B@seas.ucla.edu> (raw)

Could someone please help me understand this.  Either there is a large
group of syntactic constructs I missed in the manual, or I am
still stuck in c++/smalltalk mode, or I just don't get it.

It seems to me (in my VERY limited Ada knowledge) that packages are 
like classes for OOP purposes.  They have the features of data hiding, and
binding procedures with data, hiding implementation, etc. But, how
do you get more than one of them in a procedure/function.

For instance, if I define the package STACK to have the procedures
POP which returns say, an integer, and PUSH(X:integer), and I want
to use my STACK in a procedure, I do something like (please, although my
Ada style may not be the usual as I'm new, I think it's clear what I'm asking,
so...)

with STACK;
procedure foo is
use stack;
test:integer;

begin
--a procedure body
end foo;

and inside foo I can call test = POP;
and this works.  But, what if foo needed TWO stacks, or three? As STACK
doesn't appear to be named, it doesn't look like an object.  It's a 
support library, rather than a data type?  But, that wasn't what I 
thought it was supposed to be.  If it is just a library of functions,
then does Ada have a class/object structre?  How about all the OOP
subjects I've  seen on this list lately- surely it must.

-andy		caldwell@seas.ucla.edu




             reply	other threads:[~1994-11-27  4:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-27  4:42 Andrew E. Caldwell [this message]
1994-11-27 14:58 ` don't understand packages vs. objects/classes Roger Labbe
1994-11-28 11:35   ` David Weller
1994-11-28 15:02 ` Mark C. Chu-Carroll
  -- strict thread matches above, loose matches on Subject: below --
1994-11-29 17:04 Bennett, Chip (KTR) ~U
replies disabled

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