On 2017-05-31 09:09, Jonathan M Davis via Digitalmars-d wrote:
Hmmm. That would make abstract inconsistent with other attributes on a
class, but after messing around with it a bit, it looks like the only effect
that marking a class with abstract has is how many times you get a linker
error about the member function not being defined. So, it looks like a I did
indeed remember incorrectly (or just misunderstood), but the behavior that
we do get with regards to putting abstract on the class is rather weird as
well as inconsistent with what happens with other attributes on a class. But
on reflection, that's probably because you wouldn't want to mark a function
with a body as abstract, meaning that marking abstract on a class would
either have to be ignored as it seems to be, or it would have to be ignored
on any function that has a body, which would probably cause problems with
.di files. So, I stand corrected.
The behavior actually makes sense.
If you mark the whole class as "abstract", you cannot create instances
of the class.
If you mark a method "abstract" it will force any sub classes to
override that method. Since a sub class has to override the method it
doesn't make sense to allow to create instances of the class, implicitly
making the whole class abstract.
--
/Jacob Carlborg