Should operator overload methods be virtual?

retard re at tard.com.invalid
Fri Nov 27 19:58:00 PST 2009


Fri, 27 Nov 2009 15:32:21 -0800, Walter Bright 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.

Is this again one of those features that is supposed to hide the fact 
that dmd & optlink toolchain sucks? At least gcc can optimize the calls 
in most cases where the operator is defined to be virtual, but is used in 
non-polymorphic manner.



More information about the Digitalmars-d mailing list