D - virtual function overrides
- Charles Nevill (10/10) Apr 19 2004 (apologies in advance if this has been brought up already; a cursory sea...
- John Reimer (4/16) Apr 19 2004 Yep...
(apologies in advance if this has been brought up already; a cursory search suggested it had not) '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) '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