shadows an overridable method in the base class

vb.net

Solution

Changing it to overrides is not the same. You can add the keyword `Shadows` to eliminate the warning, but if you have run it for a long time with the message, changing them to override may cause things to work differently than before.

The only difference between overrides and shadows is that shadows does not have the polymorphic effect that overrides does, so if you call a method on a base class object, even if it happens to be holding a child class instance, the base class method is always called.

But again, if you are getting that warning, it means it is adding the `Shadows` keyword for you, but it throws the warning to make sure that is the effect you want, you can eliminate it by just adding the keyword yourself. If you suspect that `Overrides` was the behavior you wanted, you can add it as well, just realize that they are not equivalent.

Problem

I'm currently on a new project and there's a lot of this warning: function 'yyy' shadows an overridable method in the base class 'zzz'. To override the base method, this method must be declared 'Overrides'. I'm wondering if it's safe to put everything as Overrides. Is this the default behavior? There will be a lot of testing done and I want to minimize the problems.

Original source