Difficulty: Easy
Correct Answer: When overriding, the method name and full signature must exactly match the virtual member being overridden.
Explanation:
Introduction / Context:
Overriding in C#.NET lets a derived class provide a new implementation for a virtual (or abstract) member from a base class. Correct matching of signatures is essential.
Given Data / Assumptions:
Concept / Approach:
To override, a base member must be virtual/abstract, and the derived method must use the override keyword. The method's name, return type, and parameter types and order must exactly match (excluding optional parameters metadata differences). Static members cannot be virtual; abstract methods are implicitly virtual and must be overridden in a non-abstract derived class.
Step-by-Step Solution:
Verification / Alternative check:
Compile small examples with and without matching signatures to see compiler diagnostics.
Why Other Options Are Wrong:
They contradict C# language rules on virtual and abstract members.
Common Pitfalls:
Confusing hiding (new) with overriding (override).
Final Answer:
When overriding, the method name and full signature must exactly match the virtual member being overridden.
Discussion & Comments