Skip to content
Sharp

Object-oriented programming · interview question

What problem might arise if a ShoppingCart directly manipulates Product details without using its interface?

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

Correct answer

C. It can lead to tight coupling and fragile code.

Why

Direct manipulation of Product details by ShoppingCart leads to tight coupling, making code fragile and harder to maintain as changes in Product can have widespread unintended consequences.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →