OpEquals and Interfaces

Christoph Mueller ruunhb at googlemail.com
Tue Apr 13 12:50:36 PDT 2010


I'm currently writing a library in D2 which uses intensively interfaces 
and i meet a problem by overloading the opEquals Operator.

In some of my implementations i want to compare an object through an 
interface of another instance

Unfortanetly, the opEquals Operator uses only Object parameters and 
according to the current DMD-Compiler it's not possible to cast implicit 
an Interface to an Object. (Got a nice compiler error)

Is there any reason to forbid implicit downcasting from any interface to 
Object?

Of course, explicit downcasting cast(Object) is also possible, but 
casting everytime for == operator is not really nice.

Chris


-- 
ruunhb [AT] googlemail.com
http://www.ruuns.de/blog



More information about the Digitalmars-d mailing list