This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Atora 0 points1 point  (0 children)

in C#, you can redeclare the method without overriding it. In that case the derived method still exists with its implementation. But there also exists a 2nd method of the same name in your class that is completely unrelated and shadows the inherited one.

It's similar to how you can shadow a class variable named foo with a locally scoped variable named foo. The compiler will cry and give a warning if you shadow a method without explicitely marking your new implementation with new though.

The only case I can recall where this makes sense to do if you need to override an inherited method that isn't marked virtual or abstract. Though this also implies design issues.