Static operator overloads (again)

Giles Bathgate gilesbathgate at gmail.com
Thu Sep 4 02:47:20 PDT 2008


Christopher Wright Wrote:

> On the other hand, what about subclasses? They can't override the 
> behavior of an operator overload, if operator overloading uses static 
> methods. You're reduced to writing your overloads as:
> 
> class Foo
> {
> 	static Foo opAddAssign (Foo left, Foo right)
> 	{
> 		return left.addAssign(right);
> 	}
> }
> 

I don't understand your example. It was my understanding that static methods cannot be overridden. (there is no vtable entry for a static method)

Maybe you thought that I an requesting for D's implementation of operator overloads to ONLY use static methods?



More information about the Digitalmars-d mailing list