[5936] in java-interest
Re: Why use interfaces?
daemon@ATHENA.MIT.EDU (R. Mark Volkmann)
Tue Mar 5 17:54:25 1996
Date: Tue, 05 Mar 1996 12:31:05 -0600
From: "R. Mark Volkmann" <m224873@svmstr01.mdc.com>
To: dc <dc@symbolicsoft.com>
Cc: java-interest@java.sun.com
dc wrote:
>
> Trying to understand what is the point of interfaces.....
>
> As I understand, an interface just specifies functionality that an object
> will implement - but doesn't link in any of that functionality.
>
> So if I define a class 'myRect' that implements 'drawable', I still have to
> put all the drawcode in 'myRect' - and if I then make a 'myCircle' the code
> gets duplicated - it doesn't substitute for multiple inheritance.
>
> How do interfaces help? I can't see the advantage, apart possibly from
> documentation.
The whole point is polymorphism. Objects of classes which implement a
common interface can all be used as arguments to methods which expect an
argument of that interface type.
============================================================================
R. Mark Volkmann - Principal Specialist Programmer/Analyst
McDonnell Douglas Aerospace, St. Louis, Missouri, USA
email m224873@svmstr01.mdc.com, voice (314)232-0498
"No one welcomes change except a wet baby."
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com