Bird
0
0

Which keyword is used in C# to allow a method to be overridden in a derived class?

easy📝 Syntax Q12 of 15
C Sharp (C#) - Polymorphism and Abstract Classes
Which keyword is used in C# to allow a method to be overridden in a derived class?
Avirtual
Boverride
Cnew
Dabstract
Step-by-Step Solution
Solution:
  1. Step 1: Identify keyword to enable overriding

    The base class method must be marked with virtual to allow overriding.
  2. Step 2: Understand roles of keywords

    override is used in derived classes, virtual in base classes.
  3. Final Answer:

    virtual -> Option A
  4. Quick Check:

    Base method uses virtual to allow override [OK]
Quick Trick: Base method uses virtual; derived uses override [OK]
Common Mistakes:
MISTAKES
  • Using override in base class instead of virtual
  • Confusing new keyword with override
  • Thinking abstract is required for all overrides

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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