over ride vs new

The override modifier is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event.

When used as a modifier, the new keyword explicitly hides a member inherited from a base class. When you hide an inherited member, the derived version of the member replaces the base-class version. Although you can hide members without the use of the new modifier, the result is a warning. If you use new to explicitly hide a member, it suppresses this warning and documents the fact that the derived version is intended as a replacement.

To hide an inherited member, declare it in the derived class by using the same name, and modify it with the new modifier.

Comments

Popular Posts