how can i differenciate between them, in java.
any details, any code examples plz.
thanx in advance.
------------------
An agregation is a whole/part relationship, but the parts me be shared with other objects, and may also have life time outside the scope of the whole.
.......
The use of Composition depends on how strongly the reliationship is emphazed within the system.If the concept of Engine has been separated from the concept of the car...... But the rules of the system state the car cannot exist witout an Engine, so you must use composition.
Originally posted by Cindy Glass:
In the case of composition the object is created with the new operator [b]inside the class and the reference placed in a variable. In the case of aggregation the object was created somewhere else and passed into the class using a method which then puts the reference into a variable.[/B]