Why do 'abstract' methods with 'in' or 'out' contracts require a body?

Trey Brisbane via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 13 01:35:30 PDT 2014


On Saturday, 13 September 2014 at 07:32:23 UTC, Marc Schütz wrote:
> I thought it was an error, but then I found this in the 
> documentation:
>
> http://dlang.org/attribute.html#abstract
>
> "Functions declared as abstract can still have function bodies. 
> This is so that even though they must be overridden, they can 
> still provide ‘base class functionality.’"
>
> => it's intentional

Can != must ;)

Interesting fact, but it still looks like a bug to me. The 
contract shouldn't be forcing a body on an abstract method 
regardless of whether or not abstract methods are allowed to have 
bodies.


More information about the Digitalmars-d-learn mailing list