Hijacking

Mike Capp mike.capp at gmail.com
Sun Aug 5 19:10:58 PDT 2007


Walter Bright Wrote:

[re:making 'override' mandatory]

> That is a good point. The reason I haven't added it is because I'm not 
> sure how annoying it will be to have to always add the 'override' 
> keyword. It might be one of those things like exception specifications 
> where everyone says it's a good idea but guiltily hate in secret <g>.

C# has this rule, and based on 3-4 years of using it I'd say it's fine. No annoyance in the general case; in fact it normally _saves_ typing since you can just type "override" and ReSharper (a refactoring plugin for VS) offers completions based on virtuals in the base class. And it's been a useful warning of unintended overrides many a time.

The one case where the rule does feel annoying is when you have an interface, an abstract base class implementing that interface with pure virtuals while providing common functionality, and a concrete subclass. In D you'd probably mixin the base stuff, so this case wouldn't arise.




More information about the Digitalmars-d mailing list