aliasing base methods
xs0
xs0 at xs0.com
Mon Feb 26 14:22:06 PST 2007
Frank Benoit (keinfarbton) wrote:
> My point is, i want this strange rules to be removed.
> And I want the override keyword not to be a useless thing.
>
> I propose:
> 1.) make an overload not hide base implementations
Definitely. Imho, hiding them achieves nothing except annoyance..
Though, if I recall correctly, the argument for hiding is the following
- if the base class gets a method with the same name, users of the
derived class will start calling the new method in some cases, most
probably causing trouble (as the derived class now doesn't override the
new method, even if it previously did override all other methods with
the same name).
But, it seems that most people don't expect the hiding to happen, and
the alias workaround just seems wrong somehow, at least to me. So, why
not introduce some new syntax?
class Derived : Base {
override foo; // I declare that I'll be overriding all foos
// override no longer needed here or in other foos, even
// if override is made mandatory
public void foo(int i) { .. }
}
Problem solved :)
> 2.) make the override keyword required, to make it useful.
+1
> 3.) remove the interface reimplementation rule.
Well, it can be useful in similar cases as for 1, so why not remove
reimplementation requirement by default, but with the option of
class NewFoo : OldFoo, override IFoo
{
// reimplementation required
}
xs0
More information about the Digitalmars-d
mailing list