Here you create the Node object inside Queue. This means the Node object's existence completely depends upon Queue object's existence. If Queue object is destroyed, then there is no way for Node object to survive.
In Aggregation, the life of an object may not depend on its container. That means, the referenced object may survive even the container is destroyed.
Hope this link gives you better understanding on Aggregation and Composition with proper Java code samples.
0
Bruce
On
It is composition. A queue consists of 0 to many nodes. If the queue is deleted, all the nodes are deleted. A node would not exist outside of the queue (if I have your meaning right).
Here you create the Node object inside Queue. This means the Node object's existence completely depends upon Queue object's existence. If Queue object is destroyed, then there is no way for Node object to survive.
In Aggregation, the life of an object may not depend on its container. That means, the referenced object may survive even the container is destroyed.
Hope this link gives you better understanding on Aggregation and Composition with proper Java code samples.