Skip to content
Sharp

Object-oriented programming · interview question

Why can not using encapsulation become a problem in practice?

Multiple choiceEasychapter-3-curatedpremiumoopinvariants-and-validation
Choose one answer
Answer and explanation

Correct answer

A. Difficulty in maintaining invariants

Why

Without encapsulation, it becomes difficult to maintain invariants as external code can modify the internal state directly, leading to potential inconsistencies.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →