Difficulty: Easy
Correct Answer: virtual
Explanation:
Introduction / Context:
In C#.NET, runtime polymorphism depends on whether the base member is declared in a way that permits overriding. If the base member does not allow overrides, a derived class cannot truly replace its behavior polymorphically.
Given Data / Assumptions:
Concept / Approach:
The base class must mark a method or property as virtual (or abstract). A derived class then uses override to supply the new implementation. Using new merely hides a member at compile time but does not participate in dynamic dispatch through a base reference.
Step-by-Step Solution:
Verification / Alternative check:
Test with Base b = new Derived(); b.M(); and observe the derived implementation executing.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing new with override leads to unexpected base behavior when using base-typed references.
Final Answer:
virtual
Discussion & Comments