Skip to content
Sharp

Object-oriented programming · interview question

In the context of encapsulation, what is a potential downside of using too many getter methods?

Multiple choiceHardchapter-3-curatedpremiumoopcontrolled-mutation
Choose one answer
Answer and explanation

Correct answer

C. It can lead to exposure of internal state, violating encapsulation.

Why

Using too many getters can expose the internal state of an object to external classes, potentially breaking encapsulation by allowing unintended dependencies and modifications.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →