implement abstract method requires override

"Luís "Luís
Sat Nov 9 18:32:16 PST 2013


Why do abstract methods need to be implemented with override, 
when interfaces don't? E.g.:

     class X
     {
         abstract void foo();
     }

     class Y : X
     {
         override void foo() {}
     }

vs

     interface X
     {
         abstract void foo();
     }

     class Y : X
     {
         void foo() {}
     }

This is a bit of a problem for a design I'm doing with 
template/mixin magic, making it a bit less magical. If you don't 
want to change this, would you consider at least providing some 
kind of pragma / attribute to work around it? E.g.

     class X
     {
         pragma(nooverride, foo); // this or the following
         @nooverride abstract void foo(); // ugly OK, X is hidden 
for user
     }

     class Y : X
     {
         void foo() {}
     }

Thanks! :-)


More information about the Digitalmars-d mailing list