Re: Implement interface



On Sun, 29 May 2005 19:22:40 GMT, Tony Johansson wrote:
> When a class implaments an Interface must the class implement all
> methods? Whan happen if the class don't implament all methods in the
> interface.

You have two choices:

- implement every method required by the interface

or

- declare the missing methods abstract in your class. This forces you
to declare your class abstract and, as a result, forces you to
subclass the class (and implement the missing methods) before you
can create any objects.

> Will it cause compile error then.

Otherwise, yes.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
.



Relevant Pages

  • Re: Multiple bounds in a generic declaration
    ... How can I declare this ArrayList? ... both the interface and the listener are existing classes I cannot ... Many of the prebaked existing subclasses of the FormWidget implement ... public class A extends FormWidget implements Listener; ...
    (comp.lang.java.help)
  • Re: Multiple bounds in a generic declaration
    ... Both Foo is an abstract class and Bar is in this case a listener ... How can I declare this ArrayList? ... both the interface and the listener are existing classes I cannot ... Many of the prebaked existing subclasses of the FormWidget implement ...
    (comp.lang.java.help)
  • Re: Behavior of out parameters and dependencies
    ... In most cases it will be ok to just declare the pointers as ref, ... >> Let's say there is Some Interface called IFoo. ... it is allocated by GetData using CoTaskMemAlloc. ...
    (microsoft.public.win32.programmer.ole)
  • JDK implementation of inner classes doesnt match Java Language Specification
    ... According to the Java Language Specification 3.0: "A nested class is ... Inner classes may not declare static members, ... interface D //Interface ...
    (comp.lang.java.programmer)
  • Marshal Structure containing arrays to function in DLL
    ... Declare Function nifGetInterfaceList Lib "nifbstd" (ByVal session As Long, ... ByRef info As NifInterfaceInfo) As Long ... Private Sub OpenSess() ... ' Pass the max interface number to function "nifGetInterfaceList" ...
    (microsoft.public.dotnet.languages.vb)