🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #282

Re: Multiple interfaces

#282
From: Darryl L. Pierce
Date: Mon, 17 Jun 2002 11:46
34 lines
2353 bytes
On Mon, 17 Jun 2002 00:56:34 -0400, Tristan Reeves wrote:

> Nothing in particular, it's a general observation related to custom
> interfaces:
> 
> interface Intf1{
>     public void X();
> }
> 
> interface Intf2{
>     public void X();
> }
> 
> class MyClass implements Intf1, Intf2{
>     ????
> }

What's the problem with the above? In true multiple inheritance, where
you're inheriting multiple _implementations_, the diamond-of-death occurs
where you're not sure which _inherited_ implementation to invoke first,
or whether it's desirable to invoke one first. With Java, you have
multiple inheritance on at the _interface_ level, which alleviates the
diamond-of-death problem: you only have one inherited implementation on
_any_ method, and that solves the problem of "which inherited
implementation to invoke first".

HTH.

-- 
/**
 * @author Darryl L. Pierce <mcpierce@databasix.com>
 * @see    The Infobahn Offram <http://welcome.to/mcpierce>
 * @quote  "What do you care what other people think, Mr. Feynman?"
 */
Technical Details
Message-ID: <pan.2002.06.17.07.46.24.235390.777@databasix.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!DirecTVinternet!DirecTV-DSL!nopics.sjc!not-for-mail
References: <1024283082.192985@web.apex.net.au> <JScP8.111$Fv1.17660@newsread2.prod.itd.earthlink.net> <1024289793.45649@web.apex.net.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10a146,113f3357bc588129
X-Google-Attributes: gid10a146,public
X-Google-Thread: 10d6db,113f3357bc588129
X-Google-Attributes: gid10d6db,public
X-Google-Thread: f74b3,113f3357bc588129
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2002-06-17 04:52:06 PST
From: "Darryl L. Pierce" <mcpierce@databasix.com>
Subject: Re: Multiple interfaces
Date: Mon, 17 Jun 2002 07:46:28 -0400
Newsgroups: aus.computers.java,borland.public.jbuilder.java.language,comp.lang.java.programmer
Organization: Out-Of-Work Hackers Anonymous
Message-ID: <pan.2002.06.17.07.46.24.235390.777@databasix.com>
References: <1024283082.192985@web.apex.net.au> <JScP8.111$Fv1.17660@newsread2.prod.itd.earthlink.net> <1024289793.45649@web.apex.net.au>
User-Agent: Pan/0.11.2 (Unix)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Comment-To: "Tristan Reeves" <moonshine@apex.net.au>
NNTP-Posting-Host: nopics.sjc
X-Trace: nopics.sjc 1024315780 64.192.144.133 (17 Jun 2002 05:09:40 -0700)
Lines: 34
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!DirecTVinternet!DirecTV-DSL!nopics.sjc!not-for-mail