Interviews - C# Corner

Ahsan Siddique
What is Composition and Aggregation? And difference among both
By Ahsan Siddique in .NET onFeb 05 2018
  • Nilesh Shah
    Feb, 2018 15

    category should not be .NET

    • 3
  • Rajneesh Chaubey
    Feb, 2018 7

    Actually, Aggregation and Composition are subsets of association meaning they are specific cases of association. In both aggregation and composition object of one class "owns" object of another class. But there is a subtle difference:Aggregation implies a relationship where the child can exist independently of the parent. Example: Class (parent) and Student (child). Delete the Class and the Students still exist. Composition implies a relationship where the child cannot exist independent of the parent. Example: House (parent) and Room (child). Rooms don't exist separate to a House.

    • 2

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS