Which statement describes aggregation?

Prepare for the Object-Oriented Programming Test with flashcards and multiple choice questions. Each question comes with hints and explanations to enhance understanding. Master OOP concepts and succeed in your exam!

Multiple Choice

Which statement describes aggregation?

Explanation:
Aggregation is a has-a relationship where the parts can live on independently of the whole. In this kind of association, the lifecycle of the components isn’t tied to the container, and a part can exist without the container or even be related to multiple wholes. That’s why describing parts as able to exist independently of the whole best captures aggregation. By contrast, a statement about the whole destroying its parts when it’s destroyed points to a tighter coupling known as composition, where the parts’ lifetimes are bound to the whole. Saying parts cannot exist without the whole also describes that strong ownership. And calling the relationship is-a refers to inheritance, not aggregation.

Aggregation is a has-a relationship where the parts can live on independently of the whole. In this kind of association, the lifecycle of the components isn’t tied to the container, and a part can exist without the container or even be related to multiple wholes. That’s why describing parts as able to exist independently of the whole best captures aggregation.

By contrast, a statement about the whole destroying its parts when it’s destroyed points to a tighter coupling known as composition, where the parts’ lifetimes are bound to the whole. Saying parts cannot exist without the whole also describes that strong ownership. And calling the relationship is-a refers to inheritance, not aggregation.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy