OpEquals and Interfaces

Jason House jason.james.house at gmail.com
Tue Apr 13 16:47:13 PDT 2010


Steven Schveighoffer Wrote:

> On Tue, 13 Apr 2010 15:50:36 -0400, Christoph Mueller  
> <ruunhb at googlemail.com> wrote:
> 
> > 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?
> 
> Any good reason? No.
> 
> But the stated reason is usually that interfaces don't necessarily have to  
> be Objects, they can be COM objects, which 1) has no bearing in some OSes,  
> and 2) does anyone use this feature?

It could also be a C++ class




More information about the Digitalmars-d mailing list