Bird
Raised Fist0

What keyword in C# allows a method in a base class to be changed by a derived class?

easy🧠 Conceptual Q11 of Q15
C Sharp (C#) - Inheritance
What keyword in C# allows a method in a base class to be changed by a derived class?
A<code>new</code>
B<code>override</code>
C<code>virtual</code>
D<code>abstract</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand base class method flexibility

    The virtual keyword marks a method in the base class as changeable by derived classes.
  2. Step 2: Differentiate from other keywords

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

    virtual -> Option C
  4. Quick Check:

    Base method change = virtual [OK]
Quick Trick: Base class method change uses virtual keyword [OK]
Common Mistakes:
MISTAKES
  • Confusing override with virtual
  • Using new instead of virtual for overriding
  • Thinking abstract allows method change without implementation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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