4번독수리의 둥지

HAS-A, IS-A terminology in object oriented language 본문

공부할것들

HAS-A, IS-A terminology in object oriented language

4번독수리 2015. 11. 6. 10:58

http://stackoverflow.com/questions/2218937/has-a-is-a-terminology-in-object-oriented-language

 

This is object-oriented programming and UML terminology, not Java-specific. There are actually three cases you should be aware of:

  1. A House is a Building (inheritance);
  2. A House has a Room (composition);
  3. A House has an occupant (aggregation).

The difference between (2) and (3) is subtle yet important to differentiate. Together they are forms of association. What's the difference? Composition implies the child object cannot live out of the context of the parent (destroy the house and rooms disappear) whereas aggregation implies the child can exist on its own (destroy the house and the occupant goes elsewhere).

'공부할것들' 카테고리의 다른 글

타원곡선 서명  (0) 2018.05.02