Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Inheritance and Polymorphism

MediumTechnical Fundamentals00:00
Practice interviewer
In session
5 left
00:00

Your question is Inheritance and Polymorphism. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

You need to log in / sign up to chat or submit.

Problem

Explain inheritance and polymorphism in object-oriented programming and give an example of when you would use each.

Discuss how inheritance defines relationships between types, how method overriding enables runtime polymorphism, and the trade-offs of using these mechanisms. Use a concrete example in a mainstream object-oriented language.

Scope: focus on class-based object-oriented programming and distinguish inheritance from composition where relevant.