True, and that advantage rarely comes up.

However declaring abstract methods in an abstract class has exactly
the same problem that adding interface methods does -- and I take it
this is the heart of the problem -- all implementors get broken
immediately. If you intend to add methods this way, neither one is any
different indeed, both have the same problem.

Abstract classes afford the possibility of adding methods plus
implementation, without breaking anybody, so yeah I'm into abstract
classes. But then that's no argument against an abstract class +
interface, which would add a small bit of flexibility too.

I don't feel strongly about it but do think the interface + abstract
approach is more conventional than declaring APIs through abstract
classes.

On Tue, Nov 24, 2009 at 8:49 PM, Yonik Seeley
<yo...@lucidimagination.com> wrote:
> The only advantage an interface has over an abstract class is multiple
> inheritance.
> You can use abstract classes like interfaces: make it possible to
> override all methods and avoiding state unless absolutely needed for
> back compat changes.

Reply via email to