Skip to content
Sharp

Object-oriented programming · interview question

In which scenario does method overriding violate the Liskov Substitution Principle?

Multiple choiceHardchapter-5-curatedpremiumoopmethod-overriding
Choose one answer
Answer and explanation

Correct answer

C. When the overridden method breaks expected behavior contracts.

Why

The Liskov Substitution Principle is violated when an overriding method breaks expected behavior contracts, as it implies that a subclass cannot be substituted for a superclass without altering the desirable properties of the program.

Test yourself on Object-oriented programming

A free test with instant, explained results. No account needed.

Start free test
All Object-oriented programming questions →