Suggestion: overruling should not hide final overload functions
Kristian
kjkilpi at gmail.com
Fri Aug 25 10:02:19 PDT 2006
On Fri, 25 Aug 2006 18:20:26 +0300, Don Clugston <dac at nospam.com.au> wrote:
> 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.
Well, a deriving class cannot call private functions of its base class
anyway. I'm not suggesting that private flags should be overruled here;
all the private functions are hidden in deriving classes as normal.
More information about the Digitalmars-d
mailing list