Abstract classes vs interfaces, casting from void*

Alex sascha.orlov at gmail.com
Sat Aug 10 10:11:15 UTC 2019


On Saturday, 10 August 2019 at 08:20:46 UTC, John Colvin wrote:
> On Friday, 9 August 2019 at 13:39:53 UTC, Simen Kjærås wrote:
>> <snip>
>
> Thanks for the extra detail.
>
> Is there a solid reason to ever use an interface over an 
> abstract class? (Other than multiple inheritance).
>
> I'm such a noob at anything related to OO.

The general question is tricky, as different languages differ in 
details what is forced and what is allowed for abstract classes 
and interfaces.

But roughly speaking, my opinion is: if you can/want to provide 
some default behavior than you are about to write an abstract 
class.
If you are about to provide information/restriction of behavior, 
then this is more like an interface.


More information about the Digitalmars-d-learn mailing list