Object composition (source code)

= Object composition

Object composition builds behavior by storing component <software objects> and delegating operations to them. A containing <software object> can expose a distinct <object interface> and control which operations affect additional state. Exclusive ownership or a specified reference-aliasing discipline may be needed to protect its <representation invariant>. Unlike subclass overrides, <object methods> of a separate component do not dynamically dispatch into the containing wrapper.