HAS – A Relationship

HAS – A Relationship
  • Also known as Composition or Aggregation .
  • There is no specific keyword, but most of the cases we can implemented by using new keyword.
  • Main advantage is reusability.
public class engine {
   m1(){}
   m2(){}
    .
    .
    .
}

public class car {
   engine e = new engine();
  .
  .
}

Here Class car has engine

The main disadvantage of HAS – A relationship is it increases dependency b/w components and creates maintainability problems.

HAS – A Relationship


Scroll to top