D - virtual function overrides
- "Charles Nevill" <foo misterfoo.com> Apr 19 2004
- John Reimer <jjreimer telus.net> Apr 19 2004
(apologies in advance if this has been brought up already; a cursory search suggested it had not) One great feature of C# (and perhaps other OOP languages as well) is the 'override' keyword, used to indicate that a given function is intended to override some function in a base class. I can't count how many bugs I've found in C++ code (mine and others') that could have been avoided if this were supported; it's very easy to change the signature of a virtual function in a base class and forget to update some derived class, resulting in a nasty, hard-to-spot bug. Has some mechanism of this sort been considered for D?
Apr 19 2004
Charles Nevill wrote:(apologies in advance if this has been brought up already; a cursory search suggested it had not) One great feature of C# (and perhaps other OOP languages as well) is the 'override' keyword, used to indicate that a given function is intended to override some function in a base class. I can't count how many bugs I've found in C++ code (mine and others') that could have been avoided if this were supported; it's very easy to change the signature of a virtual function in a base class and forget to update some derived class, resulting in a nasty, hard-to-spot bug. Has some mechanism of this sort been considered for D?
Yep... see http://www.digitalmars.com/d/attribute.html Override is described on that page.
Apr 19 2004








John Reimer <jjreimer telus.net>