Skip to content
Sharp

Object-oriented programming · interview question

How does encapsulation contribute to safe object design?

Multiple choiceMediumchapter-3-curatedpremiumoopaccess-modifiers-and-visibility
Choose one answer
Answer and explanation

Correct answer

C. By restricting direct access to the object's state

Why

Encapsulation contributes to safe object design by restricting direct access to an object's state. This allows the class to control how its data is accessed and modified, ensuring consistency and reliability.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →