Skip to content
Sharp

Object-oriented programming · interview question

What design issue might arise if CartItem modifies the Product quantity directly?

Multiple choiceHardchapter-2-curatedpremiumoopobject-interaction
Choose one answer
Answer and explanation

Correct answer

C. It can lead to inconsistent product data across the system.

Why

Allowing CartItem to modify Product quantity directly violates encapsulation and can lead to inconsistent product data, as multiple items might have conflicting changes.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →