opEquals

deed none at none.none
Tue Dec 4 16:17:01 PST 2012


interface I
{
     bool opEquals(I i);
}

class C : I
{
     bool opEquals(I i)
     {
         return true;
     }
}

void main()
{
     I i1 = new C;
     I i2 = new C;
     assert(i1 == i2);  // Assertino failure
     assert(i1 != i2);  // Passes, although it's the opposite of 
what I want..
}

What's missing?


More information about the Digitalmars-d-learn mailing list