Inherent code performance advantages of D over C?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat Dec 7 09:49:15 PST 2013


On 07/12/13 18:29, Walter Bright wrote:
> D doesn't allow overriding non-virtual functions (unlike C++).

I'm speaking of the case where what you mean to write is,

     final class Foo
     {
         /* ... lots of methods which are all final, because
          * the class as a whole is final
          */
     }

but what you actually write is,

     class Foo    // Whoops!  Forgot the final
     {
         /* ... lots of methods which, because of the missing
          * "final", are instead virtual and can be overridden
          */
     }

In this case you can't fix the original error -- by adding "final" before the 
class declaration -- without risking breaking downstream code, because someone 
may have created a subclass of Foo that overrides one or more of its methods.


More information about the Digitalmars-d mailing list