comp.lang.ada
 help / color / mirror / Atom feed
From: Hyman Rosen <hyrosen@mail.com>
Subject: Re: Multiple interface inheritance workaround in Ada 95 / Ada 0x to satisfy a Java language advocate?
Date: Tue, 30 Jul 2002 14:20:30 -0400
Date: 2002-07-30T14:20:30-04:00	[thread overview]
Message-ID: <1028053093.903476@master.nyc.kbcfp.com> (raw)
In-Reply-To: 3D46CE25.5010102@worldnet.att.net

Jim Rogers wrote:
> In Java all classes have an ultimate shared ancestor, the Object
> class.

True, but not really relevant since Object is above (below?)
the interfaces. If I have
	Class C extends Object implements I1, I2
then if I know my I1 is a C then I know it's also
an I2, but knowing that my I1 is an Object doesn't
tell me anything.

> procedure f(item : in I1_Access)
>    if item.all in I2'Class then
> 
> Note that this performs a lookup similar to what you describe.

But it's much simpler in Ada, since there is neither multiple
inheritance nor interfaces. For the test to be potentially true,
either I1 must be a subclass of I2, in which case the test
succeeds immediately, or I2 is a subclass of I1, in which case
we must actually examine item to see whether it inherits from
an I2-derived class. If I1 and I2 are unrelated, the test will
always be false, which is not true for C++ or Java.

C++ (and maybe Java also) has additional issues because the base
class might not be accessible due to non-public inheritance, or
there may be more than one I2 in the inheritance graph.




  reply	other threads:[~2002-07-30 18:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-29 12:05 Multiple interface inheritance workaround in Ada 95 / Ada 0x to satisfy a Java language advocate? Colin Paul Gloster
2002-07-29 12:42 ` Jean-Pierre Rosen
2002-07-29 14:18   ` Colin Paul Gloster
2002-07-29 14:58     ` Jean-Pierre Rosen
2002-07-29 17:04       ` Pascal Obry
2002-07-30 13:57   ` Hyman Rosen
2002-07-30 14:27     ` Jean-Pierre Rosen
2002-07-30 15:30       ` Hyman Rosen
2002-07-30 17:34         ` Jim Rogers
2002-07-30 18:20           ` Hyman Rosen [this message]
2002-07-30 20:22             ` Robert A Duff
2002-07-30 19:17           ` Robert A Duff
2002-07-30 22:10             ` Hyman Rosen
2002-07-29 17:27 ` Hyman Rosen
2002-07-30  8:13   ` Dmitry A. Kazakov
2002-07-30 20:55     ` Robert Dewar
2002-07-31 22:08       ` Dmitry A.Kazakov
replies disabled

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