Skip to content
Sharp

Object-oriented programming · interview question

How can an abstract class enforce a contract for its subclasses?

Multiple choiceMediumchapter-5-curatedpremiumoopabstract-classes
Choose one answer
Answer and explanation

Correct answer

C. By declaring abstract methods that must be implemented.

Why

Abstract classes enforce a contract by declaring abstract methods without implementations. Subclasses are required to implement these methods, thus fulfilling the contract.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →