www.digitalmars.com         C & C++   DMDScript  

D - virtual function overrides

reply "Charles Nevill" <foo misterfoo.com> writes:
(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
parent John Reimer <jjreimer telus.net> writes:
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