Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Composition does not strictly imply inheritance. A DOM tree is a perfect example of composing nodes without inheritance.


Strange to see this worded this way because I often think of composition as the opposite of inheritance.

Instead of “this thing uses this subset of parts from its parent” it is “this thing is composed of this collection of parts.”


Can you give an example of how the composition works, or where it is used?

With everything inheriting from the Node class, I've only seen it as being an OOP/inheritance system.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: