All right, all right! Interim decision regarding qualified Object methods

Steven Schveighoffer schveiguy at yahoo.com
Thu Jul 12 19:44:47 PDT 2012


On Thu, 12 Jul 2012 22:19:35 -0400, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> That raises an interesting point. With these changes, what should  
> opEquals'
> signature be for classes? Right now, it's always
>
> bool opEquals(Object obj);
>
> Would it still have to be that?

Nope, it could be:

bool opEquals(WhateverYouWant x);

It all depends on the situation and the hierarchy.  If you are frequently  
using base classes, you will need to override the base class member.

You could duplicate the exact situation we have now in your own hierarchy  
if you wish.  You could add const if you wish.  or pure, or @safe.

With no base defined by the language, you are free to do whatever you want.

-Steve


More information about the Digitalmars-d mailing list