What is aggregation in C#?

CsharpProgrammingServer Side Programming

Aggregation is a directional relation between objects in C#. It is the relationship between objects.

For example, Employee and Address

An Employee is associated with a single Department, whereas a Department can have more than one employee. Let us see an example of Employee and Address −

public class Address {
   . . .
}

public class Employee {

   private Address addr;

   public Employee (Address addr) {

      this.addr = addr;

   }

   . . .

}
raja
Updated on 20-Jun-2020 13:15:21

Advertisements