Bird
0
0

In a piece hierarchy, a Pawn class incorrectly calls super.move() but the base Piece class has no move() method. What is the likely result?

medium📝 Analysis Q6 of 15
LLD - Design — Chess Game
In a piece hierarchy, a Pawn class incorrectly calls super.move() but the base Piece class has no move() method. What is the likely result?
AA compile-time or runtime error occurs
BThe Pawn's move method works normally
CThe base class move method is created automatically
DThe call to super.move() is ignored silently
Step-by-Step Solution
Solution:
  1. Step 1: Understand super method calls

    Calling super.move() requires the base class to have move() defined.
  2. Step 2: Base class missing move()

    If base class lacks move(), calling super.move() causes error at compile or runtime.
  3. Final Answer:

    A compile-time or runtime error occurs -> Option A
  4. Quick Check:

    Calling undefined super method = error [OK]
Quick Trick: super.method() must exist in base class [OK]
Common Mistakes:
  • Assuming base method auto-created
  • Ignoring errors from missing super method
  • Thinking call is silently ignored

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes