Skip to content
Sharp

Object-oriented programming · interview question

Why might CartItem hold a Product reference instead of copying every product field into loose variables?

Multiple choiceMediumchapter-2-curatedpremiumoopobject-references
Choose one answer
Answer and explanation

Correct answer

A. Because references let objects model relationships directly instead of duplicating scattered data

Why

Object references let the program express connections between concepts directly. A CartItem can point to a Product, which makes the model read more like the domain story and reduces loose duplicated state.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →