- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between composition and aggregation
Error. We can’t find the page you’re looking for.
Sorry for the inconvenience. Go to our homepage or check out our Latest Courses, eBooks, Prime Packs...Back to Home
Composition and aggregation are two types of association which is used to represent relationships between two classes.
In Aggregation , parent and child entity maintain Has-A relationship but both can also exist independently. We can use parent and child entity independently. Any modification in the parent entity will not impact the child entity or vice versa. In the UML diagram, aggregation is denoted by an empty diamond, which shows their obvious difference in terms of strength of the relationship.
In Composition, parent owns child entity so child entity can’t exist without parent entity. We can’t directly or independently access child entity. In the UML diagram, composition is denoted by a filled diamond.
Composition(mixture) is a way to wrap simple objects or data types into a single unit
Aggregation(collection) differs from ordinary composition in that it does not imply ownership
In composition , parent entity owns child entity.
In Aggregation , parent Has-A relationship with child entity
It is denoted by a filled diamond.
It is denoted by an empty diamond.
Child doesn’t have their own life time
Child can have their own life time
It is a strong association
It is a weak association
- Difference Between Aggregation and Composition
- What are the difference between Composition and Aggregation in C#?
- Association, Composition and Aggregation in Java
- Association, Composition and Aggregation in C#
- Difference Between Aggregation and Association
- Difference between inheritance and composition in Java
- Composition vs Aggregation in C#
- Difference between Association and Aggregation in Java
- MongoDB aggregation and projection?
- Match between fields in MongoDB aggregation framework?
- Difference between C# and .Net
- Difference between Process and Thread
- Difference between Concurrency and Parallelism
- Difference between localhost and 127.0.0.1?
- Difference between JCoClient and JCoDestination