Re: A Java "interface" declaration does not allow a constructor to be specified in it ...
From: Oscar kind (oscar_at_danwa.net)
Date: 11/09/04
- Next message: Andrew Thompson: "Re: ZipOutputStream, ZipFile and Linux unzip do not agree on the file count in zip"
- Previous message: C B: "ZipOutputStream, ZipFile and Linux unzip do not agree on the file count in zip"
- In reply to: xarax: "Re: A Java "interface" declaration does not allow a constructor to be specified in it ..."
- Next in thread: xarax: "Re: A Java "interface" declaration does not allow a constructor to be specified in it ..."
- Reply: xarax: "Re: A Java "interface" declaration does not allow a constructor to be specified in it ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 9 Nov 2004 19:11:07 +0100
xarax <xarax@email.com> wrote:
>
> If Java supported full multiple inheritance (which is
> the implication of interface constructors), then there
> would be no need for interfaces; just use abstract classes
> in place of interfaces.
Which poses other problems. Imagine the following (but please bear with
the slightly off analogy):
abstract class Person has a non-abstract method "transport", that
implements walking.
abstract class MailDelivery has a non-abstract method "transport", which
implements mail delivery.
class MailMan extends both, and thus inherits the method transport from both
classes. For some reason, there is no reason to override it. Now please
think about these questions:
- Which one is inherited?
- If one is chosen automatically, what about dependencies in another
superclass? The two methods may have an incompatible contract.
- If the method autometically becomes abstract, why? Abstract methods are
always marked thus (either by the keyword abstract or by being defined
in an interface).
- How do you select the transport method from Person? Extend the syntax
again, with Person.super.transport()? It's hardly efficient to get a
complicated, arcane syntax.
-- Oscar Kind http://home.hccnet.nl/okind/ Software Developer for contact information, see website PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
- Next message: Andrew Thompson: "Re: ZipOutputStream, ZipFile and Linux unzip do not agree on the file count in zip"
- Previous message: C B: "ZipOutputStream, ZipFile and Linux unzip do not agree on the file count in zip"
- In reply to: xarax: "Re: A Java "interface" declaration does not allow a constructor to be specified in it ..."
- Next in thread: xarax: "Re: A Java "interface" declaration does not allow a constructor to be specified in it ..."
- Reply: xarax: "Re: A Java "interface" declaration does not allow a constructor to be specified in it ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|