What is 'Method Overriding,' and what happens if a child class calls a method that exists in both the parent and the child?

Last updated 5 July 2026

Method overriding is when a subclass provides its own implementation of a method already defined in its superclass, using the same signature; when called on an object, the child's version runs due to dynamic dispatch, but the child can still explicitly invoke the parent's version.

  • Definition: Same name, parameters, and compatible return type as the inherited method, replacing its behavior for instances of the subclass.

  • Which method runs: The child's overriding method wins based on the object's actual runtime type, not the reference's declared type (runtime polymorphism).

  • Reaching the parent version: Use super.method() (Java), base.Method() (C#), or super().method() (Python) to call the inherited implementation, often to extend rather than fully replace it.

  • Requirements: The method must be inheritable (not private/final/static in Java) and virtual where required (C# needs virtual + override).

  • https://www.igmguru.com/blog/oops-interview-questions
  • https://tryrehearsal.ai/technical-questions/explain-oops-concepts
  • https://github.com/Devinterview-io/oop-interview-questions
  • https://www.hirist.tech/blog/top-30-c-oops-interview-questions-and-answers/
  • https://www.interviewbit.com/oops-interview-questions/
  • https://blog.stackademic.com/dont-just-code-the-15-essential-practices-senior-developers-want-you-to-learn-now-84246fb2f6ed
  • https://www.reddit.com/r/ExperiencedDevs/comments/1mpaewh/how_should_i_deal_with_junior_devs_that_debate/
  • https://www.scaler.com/topics/oops-concepts-in-cpp/
  • https://javatechonline.com/interview-questions-object-oriented-programming/
  • https://henko.net/blog/my-favorite-interview-questions/
  • https://utkrusht.ai/blog/python-interview-questions
  • https://www.digitalocean.com/community/tutorials/oops-interview-questions-answers
  • https://www.scribd.com/document/510810151/Fragile-base-class
All Object-Oriented Programming interview questions