Hello!
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. Will
it cause compile error then.
//Tony
Murray - 30 May 2005 10:55 GMT
> Hello!
>
[quoted text clipped - 3 lines]
>
> //Tony
Why don't you try it and find out yourself?
A class must implement all methods of the interface, unless the class is
declared as abstract.
James McIninch - 09 Jun 2005 11:56 GMT
<posted & mailed>
> Hello!
>
> When a class implaments an Interface must the class implement all methods?
Yes, that's the idea.
> Whan happen if the class don't implament all methods in the interface.
> Will it cause compile error then.
It doesn't compile.
> //Tony

Signature
Remove '.nospam' from e-mail address to reply by e-mail
Gordon Beaton - 09 Jun 2005 15:30 GMT
> 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

Signature
[ 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