[4409] in java-interest
Re: interfaces
daemon@ATHENA.MIT.EDU (Pat Niemeyer)
Fri Dec 22 10:49:54 1995
Date: Fri, 22 Dec 1995 08:26:12 -0600 (CST)
From: Pat Niemeyer <pat@icon-stl.net>
To: Jeremy Fitzhardinge <jeremy@suede.sw.oz.au>
cc: satoh-HAL-osamu <satoo@pfu.fujitsu.co.jp>,
java-interest@webrunner.neato.org
In-Reply-To: <9512221926.ZM11192@suede.sw.oz.au>
On Fri, 22 Dec 1995, Jeremy Fitzhardinge wrote:
> On Dec 22, 4:46pm, satoh-HAL-osamu wrote:
> > I think, each class who implements multiple interfaces
> > should provide ONLY ONE method for identical method
> > prototypes. If one class can provide two or more method for
> > one method prototype, it may require name resolution such
> > likes C++'s one. And it makes Java a bit complex.
>
> That aside, if you want to have a class which implements two
> interfaces, and those interfaces happen to both have methods same
> signature (and otherwise unrelated), you just can't do it. You can
> implement one, but not both, and I'm not sure if the spec says which
> method will be implemented (perhaps both, which would be an awful
> mistake). You can rename one interface's method, but that may not be
> possible, and is needless ugliness regardless.
I don't understand your questions...
If two interfaces specify exactly the same method signature, then
the class simply has to implement that method body. If it makes you feel
better, you could think of it as being "really" required to do it, as
opposed to only required to do it ;)
interface foo {
void foo( );
}
interface bar {
void foo();
}
class thing implements foo, bar {
public void foo() {
}
}
If the methods have different signatures in any way then the methods
will be overloaded and the class will have to implement *both*.
Pat
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com