"Peter Kirk" <peter> wrote:
> "Christophe Vanfleteren" <> skrev i en meddelelse
> news:8iZ0c.19697$...
>
>> Btw, it is discussable that implemnting an interface to use static final
>> constants is bad form. You should use a class for it, and then refer to
>> them explicitly, like ClassWithConstants.SOME_CONSTANT instead.
>
> But you could still define the constants in the interface, and use them
> without implementing the interface. What is the difference between
> defining public constants in a "class" and in an "interface"?
>
> Peter
You are correct, you could use both in such a case. My point was more about
the fact that it isn't necessary to implement an interface, and is even
better not to, for reasons like binary compatibitly, encapsulation (other
classes using your class don't really care that you use certain constants
to do the job, so why make this public?), ...
--
Kind regards,
Christophe Vanfleteren
|