From: Ken Garlington <garlingtonke@lmtas.lmco.com>
Subject: Re: Ada95 OOP Questions
Date: 1996/07/30
Date: 1996-07-30T00:00:00+00:00 [thread overview]
Message-ID: <31FE03CB.7B74@lmtas.lmco.com> (raw)
In-Reply-To: 4tgi88$5fi@Masala.CC.UH.EDU
Spasmo wrote:
> Well here's the thing though, from what I'm seeing when you
> use the package you'd need to pass the parameters to the
> subprograms rather than having the data encapsulated. For
> instance in C++ you'd do the following:
>
> Person p;
> p.walk();
> p.talk();
> p.eat();
>
> But with the above you'd do something like the following:
> (Any Ada code provided may be slightly erroneous, I just want
> to give a general idea of what I think I understand hence not
> checking much).
>
> with Persons;
>
> procedure Main is
>
> P : Persons.Person;
>
> begin
> Persons.Walk(P);
> Persons.Talk(P);
> Persons.Eat(P);
> end Main;
>
> Correct me if I'm wrong on this. So you're still passing parameters
> which means that data and subprograms are still 2 different entities
> which sorta hurts the abstraction, rather than in say C++ where
> you've got a unified object.
Depends on what you're abstrating. If you don't want an abstract data type,
but you want a generic abstract data object, why not do this:
generic
package Person is
procedure Walk;
procedure Talk;
procedure Eat;
private
type Person_Type is -- as before
Object : Person_Type;
end Person;
Translating your C++ code:
package P is new Person; -- Person p;
P.Walk; -- p.walk();
P.Talk; -- p.talk();
P.Eat; -- p.eat();
Note, however, that there are things you can't do with a GADO (like
make an array of Persons) that you can do with an ADT.
If your complaint is that you like p.eat() better than eat(p), on the
other hand, then I don't see this as an abstraction difference - just
a syntax difference.
Just out of curiousity, if Person is declared in the C++ equivalent of
a package (and I forget the nomenclature -- space?), what does your C++
code look like?
--
LMTAS - "Our Brand Means Quality"
next prev parent reply other threads:[~1996-07-30 0:00 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-28 0:00 Ada95 OOP Questions Spasmo
1996-07-28 0:00 ` Andre Spiegel
1996-07-28 0:00 ` Spasmo
1996-07-29 0:00 ` Thomas Kendelbacher
1996-07-31 0:00 ` Spasmo
1996-08-01 0:00 ` Thomas Kendelbacher
1996-08-02 0:00 ` Gene Ouye
1996-08-01 0:00 ` Jon S Anthony
1996-07-30 0:00 ` Ken Garlington [this message]
1996-08-04 0:00 ` Spasmo
1996-07-30 0:00 ` David Wheeler
1996-07-31 0:00 ` Spasmo
1996-07-28 0:00 ` David C. Hoos, Sr.
1996-07-28 0:00 ` Spasmo
1996-07-29 0:00 ` Andre Spiegel
1996-07-29 0:00 ` David Wheeler
1996-07-30 0:00 ` Spasmo
1996-07-30 0:00 ` Spasmo
1996-07-29 0:00 ` Thomas Kendelbacher
1996-08-02 0:00 ` Robert Dewar
1996-08-05 0:00 ` Thomas Kendelbacher
1996-08-06 0:00 ` Robert I. Eachus
1996-08-06 0:00 ` Robert Dewar
1996-08-06 0:00 ` Thomas Kendelbacher
1996-08-06 0:00 ` Robert A Duff
1996-08-07 0:00 ` Robert Dewar
1996-08-08 0:00 ` Robert A Duff
1996-08-09 0:00 ` Robert Dewar
1996-08-12 0:00 ` Robert I. Eachus
1996-08-08 0:00 ` Theodore E. Dennison
1996-08-09 0:00 ` Robert Dewar
1996-08-12 0:00 ` Joel VanLaven
1996-08-10 0:00 ` Chris Morgan
1996-07-30 0:00 ` Andre Spiegel
1996-07-30 0:00 ` Andre Spiegel
1996-07-30 0:00 ` Robert I. Eachus
1996-08-01 0:00 ` Jon S Anthony
1996-08-13 0:00 ` Eric C. Newton
1996-08-14 0:00 ` Jon S Anthony
1996-08-14 0:00 ` Ken Garlington
1996-08-14 0:00 ` Eric C. Newton
1996-08-21 0:00 ` Jon S Anthony
-- strict thread matches above, loose matches on Subject: below --
1996-08-08 0:00 W. Wesley Groleau (Wes)
1996-08-20 0:00 Farshad Nayeri
1996-08-21 0:00 ` Jon S Anthony
1996-08-20 0:00 Farshad Nayeri
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox