Bird
0
0

Which keyword must be used in a derived class method to override a base class virtual method?

easy🧠 Conceptual Q2 of 15
C Sharp (C#) - Inheritance
Which keyword must be used in a derived class method to override a base class virtual method?
Avirtual
Boverride
Cnew
Dabstract
Step-by-Step Solution
Solution:
  1. Step 1: Identify the keyword for overriding

    In derived classes, the override keyword is required to replace the base class virtual method.
  2. Step 2: Differentiate from other keywords

    virtual is for base methods, new hides methods, and abstract is for abstract methods.
  3. Final Answer:

    override -> Option B
  4. Quick Check:

    override keyword = override base method [OK]
Quick Trick: Use override to change virtual methods in child classes [OK]
Common Mistakes:
MISTAKES
  • Using virtual instead of override in derived class
  • Using new keyword thinking it overrides
  • Confusing abstract with override

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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