Should operator overload methods be virtual?

Denis Koroskin 2korden at gmail.com
Fri Nov 27 15:50:43 PST 2009


On Sat, 28 Nov 2009 02:32:21 +0300, Walter Bright  
<newshound1 at digitalmars.com> wrote:

> Making them not virtual would also make them not overridable, they'd all  
> be implicitly final.
>
> Is there any compelling use case for virtual operator overloads? Keep in  
> mind that any non-virtual function can still be a wrapper for another  
> virtual method, so it is still possible (with a bit of extra work) for a  
> class to have virtual operator overloads. It just wouldn't be the  
> default.

I thought operator overloading was going to be implemented via templates.  
As such, they are non-virtual by default, which is okay, in my opinion.



More information about the Digitalmars-d mailing list