달력

6

« 2025/6 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
2012. 4. 28. 16:04

Aggregation과 composition의 차이 카테고리 없음2012. 4. 28. 16:04

main()

{
Greet g = new Greet(new ArrayList<String>());

Greet gt = new Greet();

}


public Greet(List l)

{
this.l = l;

}


public Greet()

{
this.l = new Greet();

}


aggregation은 부모 클래스와 독립적이다. 

하지만, composition은 부모 클래스에 종속적이다

따라서 부모 클래스가 제거되었을 때 aggregation의 자식 클래스는 살아남는다.  하지만, composition의 자식 클래스는 제거된다.

:
Posted by НooпeУ


Code Start Code End