Composition
Backlinks¶
- composition vs inheritance
- inheritance looks cleaner because it comes with abstraction, hiding some things. It creates a contract telling the user what to expect. E.g. every
image
child class hassave
&load
.
An interface allows us to do this while using composition.
- inheritance looks cleaner because it comes with abstraction, hiding some things. It creates a contract telling the user what to expect. E.g. every