Difficulty: Easy
Correct Answer: 1, 2, and 5
Explanation:
Introduction / Context:
Run-time polymorphism in C# occurs when a base-class reference invokes an overridden method on a derived object. Understanding the rules for 'virtual', 'override', and accessibility ensures correct behavior and avoids compiler errors.
Given Data / Assumptions:
Statements (paraphrased):
Concept / Approach:
C# requires base methods to be marked virtual/abstract/override to be overridden. Overridden members must keep the same accessibility, and abstract methods (and properties) are implicitly virtual and must be overridden (unless the derived class is abstract too).
Step-by-Step Solution:
Verification / Alternative check:
Create a protected virtual method in the base and attempt to override as public; the compiler errors on accessibility change. Override an abstract property; compilation is required unless the derived class remains abstract.
Why Other Options Are Wrong:
Options including 3 or 4 contradict C# rules; only 1, 2, and 5 stand together correctly.
Common Pitfalls:
Confusing 'new' (method hiding) with 'override' (polymorphism), and forgetting abstract members are implicitly virtual.
Final Answer:
1, 2, and 5
Discussion & Comments