/*
* Composition is a Association
* Aggregation is a Association
* Composition is a Strong Association (If life of contained object totally depends on container object it is called strong association)
* Aggregation is a week Association (If life of contained object doesn't depends on container object it is called week association)
*
*/
class Contained
{
public void disp()
{
System.out.println("disp() of Contained A");
}
}
public class Container {
private Contained c;
//Composition
Container()
{
c = new Contained();
}
//Association
public Contained getC() {
return c;
}
public void setC(Contained c) {
this.c = c;
}
public static void main(String[] args) {
Container container = new Container();
Contained contained = new Contained();
container.setC(contained);
}
}