Bird
0
0

In a chess system, the Knight's move() method is overridden but calling move() on a Knight reference calls the base class method. What is a likely bug?

medium📝 Analysis Q7 of 15
LLD - Design — Chess Game
In a chess system, the Knight's move() method is overridden but calling move() on a Knight reference calls the base class method. What is a likely bug?
AThe move() method in Knight is not marked as override
BThe move() method has different parameters in Knight
CThe base class move() method is final
DThe Knight object is not instantiated
Step-by-Step Solution
Solution:
  1. Step 1: Check method signature matching

    For polymorphism, overridden method must have same name and parameters.
  2. Step 2: Identify signature mismatch effect

    If Knight's move() has different parameters, base method is called instead.
  3. Final Answer:

    The move() method has different parameters in Knight -> Option B
  4. Quick Check:

    Signature mismatch breaks override [OK]
Quick Trick: Override requires exact method signature [OK]
Common Mistakes:
  • Ignoring parameter differences
  • Assuming missing override keyword causes this
  • Confusing final with override

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes