Slow performance compared to C++, ideas?

Simen Kjaeraas simen.kjaras at gmail.com
Mon Jun 3 22:05:28 PDT 2013


On Tue, 04 Jun 2013 06:16:45 +0200, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> I think it is unfair to say most classes are not base classes.  This  
> would mean most classes are marked as final.  I don't think they are.   
> One of the main reasons to use classes in the first place is for  
> extendability.

This is false. Consider this hierarchy: A->B->C, where x->y means 'x
derives from y'. There is only one base class (A), and only one class
that may be marked final (C). This will often be the case.


> BTW, did you know you can extend a base class and simply make the  
> extension final, and now all the methods on that derived class become  
> non-virtual calls?  Much easier to do than making the original base  
> virtual (Note I haven't tested this to verify, but if not, it should be  
> changed in the compiler).

This does however not help one iota when you have a reference to a base
class. This will also often be the case.

-- 
Simen


More information about the Digitalmars-d mailing list