Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35895

Re: "implements" does not mean "implements"

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.albasani.net!.POSTED!not-for-mail
From Sebastian <nowhere@nirvana.org>
Newsgroups comp.lang.java.programmer
Subject Re: "implements" does not mean "implements"
Date Sun, 13 Nov 2016 22:30:58 +0100
Organization albasani.net
Lines 34
Message-ID <o0am2g$7ji$1@news.albasani.net> (permalink)
References <implements-20161110014035@ram.dialup.fu-berlin.de> <o03914$18dp$1@gioia.aioe.org> <o06qgq$ec$1@news.albasani.net> <o076o0$11rm$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
X-Trace news.albasani.net fWHjtOFp+TJhqOiqyXKjisIu7hD7AmoBTFSUJQnj1+xCEVzdxoj8N4yfRpIIogfCnEZAM2OsHXNvQ/8lLbe0QA==
NNTP-Posting-Date Sun, 13 Nov 2016 21:30:56 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="B0+GA/CMCtQkctEbZD7kXBSv4mX5XHQfLHpfQBS8KofeoU4ep0kNBwVgEzgGauOjgVVgEASEJ32VIW7YvhfjFSAcjmcQjVgSx8wewU745aQj94Dhx1vvPqPyDnvEAOX3"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0
In-Reply-To <o076o0$11rm$1@gioia.aioe.org>
Cancel-Lock sha1:tkOPhVcqlekm7A/XdhMhyb/p/sM=
Xref csiph.com comp.lang.java.programmer:35895

Show key headers only | View raw


Am 12.11.2016 um 14:50 schrieb Arne Vajhøj:
> On 11/12/2016 5:22 AM, Sebastian wrote:
>> I like to say that interfaces specify behaviors of objects, not
>> properties of classes. Saying that C implements A amounts to saying that
>> any o that is an instance of C behaves like an A. It has nothing to do
>> with what methods get implemented in C.
>
> Behavior of objects and properties of classes should have some
> relationship.
>
> But just realized something that I think matches well
> with you way of thinking.
>
> interface A { void m(); }
>
> abstract class C implements A { }
>
> class Foobar extends C { public void m() { } }
>
> actually compiles - it is not necessary to have an abstract m in C.
>
> Arne

yes, indeed, the methods are already abstract in C by virtue of the 
interface.

By the way, a typical use of such an idiom may be where C is some 
abstract class that offers some help in implementing A, or adds related 
behavior, so that C wouldn't really be an abstraction in its own right, 
but would exist only for purposes of code-reuse. In Java 8, such usage 
could be replaced with default methods in interfaces.

-- Sebastian

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: "implements" does not mean "implements" Arne Vajhøj <arne@vajhoej.dk> - 2016-11-10 21:05 -0500
  Re: "implements" does not mean "implements" Sebastian <nowhere@nirvana.org> - 2016-11-12 11:22 +0100
    Re: "implements" does not mean "implements" Arne Vajhøj <arne@vajhoej.dk> - 2016-11-12 08:50 -0500
      Re: "implements" does not mean "implements" Sebastian <nowhere@nirvana.org> - 2016-11-13 22:30 +0100
        Re: "implements" does not mean "implements" Arne Vajhøj <arne@vajhoej.dk> - 2016-11-14 19:48 -0500

csiph-web