override deprecated
Steve Teale
steve.teale at britseyeview.com
Mon Jan 27 08:06:45 PST 2014
I'm sure this was discussed at great length sometime, but
yesterday (and the day before) I had one of those days where I
turned on warnings , and told the compiler not to ignore
deprecated things.
Most of the warnings were probably due to keyboard repeats where
I had held a key down fractionally too long while typing the
semicolon to end whatever. The other common case was fall-through
in case statements - in that case, very insidious, and the
warnings very helpful
All of the deprecated things in in my cleanup were those many
cases where I had provided alternative definitions for virtual
functions in derived classes without using override.
Now I can vaguely see the reasoning for insistence on the
override keyword. It's kind of a consequence of Walter's decision
that all member functions are virtual unless ...
But as I plodded through my code base, I came across not a single
situation where the declaration of a virtual function in some
derived class was an error.
I found a few where the declarations were redundant, in that they
were the same in effect as the function defined in the parent
class, but I was left feeling cheated. Being picky about the code
had not given me any tangible benefit.
Would it be reasonable to ask for the compiler to generate a
warning if it found that the definition of a virtual function was
the same - disregarding white space - as that in the parent
class. That would make me feel that there was some small benefit
for the insistence on 'override'.
More information about the Digitalmars-d
mailing list