Aggregation vs Composition

Answer #1

In OOP Composition reffers to the relationship between classes of type “A” let’s say containing refferences to other classes of type “B”. The second condition is that type “B” instances cannot exist without the type “A” instances.
For example a class of type “A” can be a Car and a class of type “B” can be a Wheel. Destoying the Car would also destroy the enclosed Wheel.

On a complementary look, is the Aggregation, which needs the same first condition – classes of type “A” containing refferences to other classes of type “C”, but the econd conditon says the opposite: instances of type “C” can continue to exist without the instances of type “A”.
The perfect example here, additionaly to the one above is to consider the class of type “C” as being the Driver of the Car. Destroying the Car object one will not expect that the Driver should also be destroyed, since the Driver can move to another Car or Vehicle for instance.

Answers Answered By: alo [ Grey Star Level]
cheap generic viagra from india
buy sildenafil for dogs

Answer this Question

Enter name & email to post an Answer. You can also Login / Join us

For a better management of this site please consider Logging in / Joining us before posting a Question. It makes everithing easier for us.

how long is shelf life of viagra
me tome media pastilla de viagra

Please enter the captcha code bellow.
Logged in users don't have to use captchas. Don't have an account? Join us!

free viagra trial pack nz
potenzmittel sildenafil rezeptfrei

cialis kaufen ohne rezept erfahrungen

Link Exchange:

You can add url to the best of the internet directory. Our url is added under Reference Directory
viagra cost without insurance