== operator
anonymous via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 4 09:40:45 PST 2015
On Sunday, 4 January 2015 at 15:15:09 UTC, Martin Nowak wrote:
> On Sunday, 4 January 2015 at 15:02:39 UTC, anonymous wrote:
>> On Sunday, 4 January 2015 at 05:24:09 UTC, Martin Nowak wrote:
>>> It requires a `final bool opEquals(SameClass other)` method
>>> to avoid the virtual call.
>>
>> `final bool opEquals(Object)` is enough, no?
>
> No, then you'd still need a dynamic cast for the argument.
Sure, but the method call doesn't need to be virtual. As far as I
understand, they're independent issues.
bool opEquals(Object) virtual call, dynamic cast
final bool opEquals(Object) possibly non-virtual call,
dynamic cast
bool opEquals(SameClass) virtual call, no cast
final bool opEquals(SameClass) possibly non-virtual call, no cast
More information about the Digitalmars-d
mailing list