comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@alexandria (Jon S Anthony)
Subject: Re: Ada95 OOP Questions
Date: 1996/08/01
Date: 1996-08-01T00:00:00+00:00	[thread overview]
Message-ID: <JSA.96Aug1140347@alexandria> (raw)
In-Reply-To: 4thu7u$ld3@mailsrv2.erno.de


In article <4tor2u$ksg@Masala.CC.UH.EDU> cosc19z5@Bayou.UH.EDU (Spasmo) writes:

> Gotcha.  So if I declare any type, tagged or not, then operations
> will be inherited and I can refer to them in "child packages"?
> This would mean that "inheritance" is pretty consistent regardless
> of OO extensions or not eh?

Basically, yes.  But note that this is only true of _primitive_ operations.
These can only be user defined if the type is declared in a _package spec._
and the operations are declared there along with it.  If you declare the
type anywhere else, the operations you provide (even if they are in the
same immediate scope) are not primitive and will not be inherited:

procedure P is
   type T is ...
   function F ( X : T ) return ... -- NOT primitive op of T

   type T2 is new T ...            -- F is NOT inherited
...
end P;

package body B is
   type T is ...
   function F ( X : T ) return...  -- NOT primitive op of T

   type T2 is new T ...            -- F is NOT inherited
...
end B;

package C is
   type T is ...                   -- Defined in Pkg Spec. C
   function F ( X : T ) return...  -- F IS primitive op of T

   type T2 is new T ...            -- F IS inherited
end C;

package C.D is
   type T3 is new T2...            -- F IS inherited
...
end C.D;


> : There is an essential difference between objects in C++ and Ada,
> : though; in Ada, you can't test for object identity as easily, like
> : writing "this == that" in C++ (except if you explicitly switch to
> : access types.) This can be a nuisance if you're used to OO languages
> : which support object identity directly, like C++ or Smalltalk.
> : 
> 
> Well the equality operations are defined for all types
> so isn't it just a matter of saying if this = that
> in Ada?

Typically no.  In general, this will provide value semantic _equality_
not _identity_, i.e., this and that have the same _value_ but are two
different objects.

/Jon
-- 
Jon Anthony
Organon Motives, Inc.
1 Williston Road, Suite 4
Belmont, MA 02178

617.484.3383
jsa@organon.com





  parent reply	other threads:[~1996-08-01  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 ` David C. Hoos, Sr.
1996-07-28  0:00   ` 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 [this message]
1996-07-30  0:00     ` David Wheeler
1996-07-31  0:00       ` Spasmo
1996-07-30  0:00     ` Ken Garlington
1996-08-04  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 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-06  0:00         ` Robert I. Eachus
1996-08-10  0:00         ` Chris Morgan
1996-07-30  0:00 ` Andre Spiegel
1996-07-30  0:00 ` Robert I. Eachus
1996-07-30  0:00 ` Andre Spiegel
1996-08-01  0:00 ` Jon S Anthony
1996-08-13  0:00 ` Eric C. Newton
1996-08-14  0:00 ` Ken Garlington
1996-08-14  0:00 ` Jon S Anthony
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