aliasing base methods

Frank Benoit (keinfarbton) benoit at tionex.removethispart.de
Sun Feb 25 08:03:05 PST 2007


>> 2.) make the override keyword required, to make it useful.
> 
> Not so sure about this one. It will introduce a lot of unnecessary typing
> and that can be annoying if you want the function prototypes to fit into 80
> characters. 

I think in any bigger software, the keyword override should be used
consequently. It makes sure that a typo doesn't makes an overload
instead of an override and vice versa. Which is a bug, very hard to find.

But actually this works only in one direction (1) and it cannot be enforced.

(1) Only in one direction means, you can make sure your override is an
override, but you cannot make sure your overload is an overload. If
"override" would be required, this check works in both directions. (no
"override" means, its a not an override)

Another advantage is, in big programs, classes with many methods. You
can be sure that a overridden method is marked as such. That make
understanding of code easier.

I think every good editor can assist here very good and I believe, the
benefit of an explicit "override" is higher than the cost of
typing/autocompleting it.



More information about the Digitalmars-d mailing list