In object-oriented programming, what is the difference between composition and inheritance?
-
A
Inheritance shares code at compile time; composition at runtime only
-
B
Composition models 'has-a' relationships by embedding objects; inheritance models 'is-a' relationships via subclassing
-
C
Composition requires interfaces; inheritance does not
-
D
They are interchangeable and differ only in syntax