Skip to content
Sharp

Classes and Objects · interview question

What is the clearest sign that code around when to use a class should be refactored?

Multiple choiceEasychapter-7-curatedpremiumclasses-and-objectswhen-to-use-a-class
Choose one answer
Answer and explanation

Correct answer

A. When the rule is no longer easy to trace, explain, or change without breaking nearby behavior.

Why

A refactor is justified when the code stops communicating its intent. Introduce a class when related state and behavior start traveling together often enough to deserve one concept.

Test yourself on Classes and Objects

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

Start free test
All Classes and Objects questions →