Bird
0
0

Why is the override keyword important in C# method overriding?

hard🧠 Conceptual Q10 of 15
C Sharp (C#) - Inheritance
Why is the override keyword important in C# method overriding?
AIt marks the method as private
BIt makes the method static
CIt hides the base class method without overriding
DIt ensures the method replaces a virtual method in the base class
Step-by-Step Solution
Solution:
  1. Step 1: Understand override keyword purpose

    The override keyword tells the compiler the method replaces a virtual method in the base class.
  2. Step 2: Differentiate from other behaviors

    It does not make methods static, hide methods, or change access level.
  3. Final Answer:

    It ensures the method replaces a virtual method in the base class -> Option D
  4. Quick Check:

    override keyword = replaces base virtual method [OK]
Quick Trick: Override keyword confirms method replaces base virtual method [OK]
Common Mistakes:
MISTAKES
  • Confusing override with new keyword
  • Thinking override changes access modifiers
  • Assuming override makes method static

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes