"The last feature": overridable methods in interfaces

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Feb 8 05:02:53 PST 2010


Trass3r wrote:
>> I only see two differences with abstract classes: interfaces can't 
>> have instance (and class?) variables and you can inherit from multiple 
>> interfaces. Am I missing something? Is this really necessary? Isn't 
>> abstract classes enough? Does this have similar problems (or the same) 
>> as multiple inheritance?
>>
>>
> 
> Yeah, providing default functionality that can be overridden is exactly 
> what abstract classes are for.

Abstract classes are a kludge meant to put state in a partially 
implemented class. I don't think mentioning abstract classes is a 
counter-argument to defining methods to interfaces.

> Interfaces were introduced to circumvent all those multiple inheritance 
> problems!

Yes; a problem that abstract classes are not solving.


Andrei



More information about the Digitalmars-d mailing list