Suggestion: overruling should not hide final overload functions
Don Clugston
dac at nospam.com.au
Fri Aug 25 08:20:26 PDT 2006
Kristian wrote:
> I suggest a small change to the current overload hiding rules: final
> functions should not be hidden.
>
> Logic behind this is the following:
> You can make a function final only when you know for sure that there is
> no need to change its behavior later in a deriving class.
>
> If you cannot be absolutely sure, then the function must not be final.
>
>
> That means that changing the implementation of a final function must not
> -- and cannot -- change behavior of deriving classes. (Usually this also
> means that there will be no need to change the implementation of final
> functions anyway.)
What about when you add new private functions to the base class? They
must not be virtual, because an existing derived class might already
have a function with the same name.
More information about the Digitalmars-d
mailing list