On 6/30/16 6:26 AM, jj75607 wrote:
Hello!
I need to overload opEquals on shared class C
shared class C
{
override bool opEquals(Object o) { return false; }
}
But compilation fails with the message:
Error: function f700.C.opEquals does not override any function, did you
mean to override 'object.Object.opEquals'?
What am I doing wrong?
Object.opEquals is not marked shared. You can't override a non-shared
method with a shared one.
You need to remove override.
But... unfortunately, this may not work in practice. The opEquals
handling for objects is pretty much screwed unless you have unshared
mutable objects. I think it may work for const objects, but not in a
good way.
-Steve