Abstract classes vs interfaces, casting from void*

Adam D. Ruppe destructionator at gmail.com
Sun Aug 11 20:46:30 UTC 2019


On Sunday, 11 August 2019 at 20:32:14 UTC, John Colvin wrote:
> E.g. why can I not inherit from multiple 100% abstract empty 
> classes? Wouldn't that be the same as inheriting from multiple 
> interfaces?

There's kinda no such thing as 100% empty abstract classes, since 
they all have the implicit parent of Object with its associated 
pieces. D's interfaces have no implicit parent.

But if that were to change, then yeah, it should work - that's 
basically what C++ does in lieu of interfaces.

(I personally prefer separate interfaces anyway, as it makes the 
intention clear and thus can help with better error messages and 
documentation, but it would work.)


More information about the Digitalmars-d-learn mailing list