Bird
0
0

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

easy🧠 Conceptual Q2 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?
Aoverride
Babstract
Cnew
Dvirtual
Step-by-Step Solution
Solution:
  1. Step 1: Identify keyword to enable overriding

    The keyword virtual is used in the base class method declaration to allow overriding.
  2. Step 2: Differentiate from other keywords

    override is used in derived classes to override, new hides methods, and abstract declares methods without implementation.
  3. Final Answer:

    virtual -> Option D
  4. Quick Check:

    Enable override = virtual [OK]
Quick Trick: Use virtual in base to allow overrides [OK]
Common Mistakes:
MISTAKES
  • Confusing override with virtual
  • Using new instead of virtual
  • Thinking abstract enables override

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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