comp.lang.ada
 help / color / mirror / Atom feed
* Re: Implement Inheritance (Ada83)?
@ 1995-03-10 15:15 Jeff Seigle
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff Seigle @ 1995-03-10 15:15 UTC (permalink / raw)


In article <3jkbep$d3f@theopolis.orl.mmc.com> "Theodore E. Dennison" <dennison@escmail.orl.mmc.com> writes:
>....
>Type extension can be achieved by making the "parent type" a record field in
>the
>child type. "Inheritance" is sort of automatic (just pass the parent field to
>its routines. Static dispatching can be achieved via overloading. Dynamic 
>dispatching ... SOL. Creation and deletion methods ... SOL (although there are
>things you can do to "force" creation).

It sounds like you are suggesting the following technique:  

Write a package with, say, a private type and operations on it.  Write 
another package with another private type.  The
second private type is implemented as a record, with one component of the
type defined in the first package.  The second package gives in its
specification a subprogram corresponding to each procedure available in the
first package.  The body of the subprograms in the second package are
implemented by simply calling the corresponding subprogram in the first
package.  If you use "use" clauses, you get what I think you referred to as
static dispatching.    This is definitely an implementation of the concept
of inheritance.  The *use* of these constructs is automatic, in that the 
caller can use the same (overloaded) subprogam name when invoking the
operations of either the parent or child type.  But the building of this
mechanism is very much manual.  And adding an operation to the parent
package means you have to somehow remember that you need to add it to the
child package.

Another kind of inheritance in Ada is if you derive a data type from a
private type, the derived type also inherits all of the 
subprograms you wrote for the base type.  This is true automatic
inheritance--you don't have to write those pass-throughs.   But it has 
limited utility; you can write additional operations
for the derived type but you can't give it additional attributes, as you 
can in the previous example.



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Implement Inheritance (Ada83)?
@ 1995-03-07 19:03 Jeff Seigle
  1995-03-08 13:28 ` Theodore E. Dennison
  1995-03-08 21:38 ` William Brennan
  0 siblings, 2 replies; 10+ messages in thread
From: Jeff Seigle @ 1995-03-07 19:03 UTC (permalink / raw)


In article <3jhj04$2dv@gnat.cs.nyu.edu> dewar@cs.nyu.edu (Robert Dewar) writes:
>....Inheritance is a conceptual idea, not a
>syntactic gizmo. ...you can perfectly well implement'
>the fundamental abstraction mechanism that we call inheritance in ANY
>language!

Although this statement is true, the best results are had when the language
has exlicit in its fabric the concepts that you are using to design your
software.  This seems to be the motivation for design of modern languages,
the support for techniques that developed as design concepts.
Years ago I wrote Fortran programs that used a quirk of the 
language to implement encapsulation (a kind of crude OOD; I won't include
the boring details here).  This approach has pros and cons.  The advantage
is that you are using concepts as advanced as you can without being 
constrained by the language.  The big negative is that once the code is 
written there is no enforcement of your wonderful ideas, and the next
one to come along with a mod can stomp down all of your imaginary fences.

Jeff Seigle
CSC




^ permalink raw reply	[flat|nested] 10+ messages in thread
* Implement Inheritance (Ada83)?
@ 1995-03-03 13:51 Dwayne Barrington
  1995-03-06 15:07 ` Kevin Weise
  0 siblings, 1 reply; 10+ messages in thread
From: Dwayne Barrington @ 1995-03-03 13:51 UTC (permalink / raw)


How do you implement inheritance using Ada83? Also, can you point me to any 
reference material? 

Thanks,
Dewayne Barrington
Harris Corporation



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

end of thread, other threads:[~1995-03-13  2:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-03-10 15:15 Implement Inheritance (Ada83)? Jeff Seigle
  -- strict thread matches above, loose matches on Subject: below --
1995-03-07 19:03 Jeff Seigle
1995-03-08 13:28 ` Theodore E. Dennison
1995-03-08 21:38 ` William Brennan
1995-03-10  9:35   ` Peter Hermann
1995-03-13  2:27     ` Mark A Biggar
1995-03-03 13:51 Dwayne Barrington
1995-03-06 15:07 ` Kevin Weise
1995-03-07 12:19   ` Robert Dewar
1995-03-07 13:19   ` Theodore E. Dennison

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