C# Aggregation

tutorial and example
tutorial and example

In C#, Aggregation Represents Has-A Relationship between two objects. A field of the class defines another class to reuse this in the form of association. The class is used as an entity reference.

Let’s see a simple example of Aggregation where a field address of the class Employee is defined as Address class which contains all of its components. The Address class is instantiated first and then its object is passed in instantiation of Employee class

Output