April 20, 2004 virtual function overrides | ||||
---|---|---|---|---|
| ||||
(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? |
April 20, 2004 Re: virtual function overrides | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Nevill | 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. |
Copyright © 1999-2021 by the D Language Foundation