Virtual Classes
Read Anytime,Anywhere
Home
Knowledge
English
Grammar
Essay
हिंदी
व्याकरण
निबंध
Physics
Computers
MVC
Oops
JQuery
C++
ASP.NET
Interview FAQ
Download
Contact Us
Class
Object
Encapsulation
Abstraction
Inheritance
Abstract Class
Interface
Polymorphism
Association
Aggregation
Composition
Composition
Composition is a specialized form of Aggregation. It is a strong type of Aggregation.
In this relationship, child objects does not have their lifecycle without Parent object. If a parent object is deleted, all its child objects will also be deleted. This represents 'death' relationship.
Composition is represented by a solid diamond followed by a line.
Let’s take an example of relationship between CAR and ENGINE. A CAR has a ENGINE. There is no independent life of ENGINE and an ENGINE cannot belongs to two different CARS, if we delete the CAR then the ENGINE will also be deleted automatically .
Let’s take another example of relationship between Questions and options. Single questions can have multiple options but option cannot belong to multiple questions. If we delete questions then options will also be automatically deleted.