Skip to main content

What is method hiding in C#?

Junior C#
Quick Answer Method hiding occurs when a derived class defines a method with the same name as the base using the new keyword instead of override. Unlike overriding, if you hold a base class reference, the base version gets called รขโ‚ฌโ€ the derived version only runs through a derived reference.

Answer

Method hiding occurs when a derived class defines a method with the same name as the parent class but does not override it.

The new method hides the parent method when accessed via the derived type.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice