CS304 Object Oriented Programming GDB Solution Fall 2012

Suppose we have implemented a scenario and we used aggregation in it, after some time we realize that use of aggregation is not a correct choice, now we want to use composition instead of aggregation. Can we replace composition with aggregation? At which phase(s) these changes are required?  Justify your answer with solid reasons.

Solution:

Actually composition is implemented by creating object of one class in other class but in aggregation we just put then reference of a class in another by this if we destroy master class so then other class remain save. If we want to change the aggregation relationship into composition then we have to put the object in the master class instead of reference.

DOWNLOAD SOLUTION HERE
loading...