Back to course home
0% completed
Vote For New Content
Where's composition in this example?
shivamparke
Feb 12, 2025
The given example only uses interface-based design, but it doesn't actually demonstrate composition in any way. Interfaces help segregate behaviors, they don’t use composition—they only provide a contract, especially in this example.
Specifically, composition means using object relationships (has-a) instead of inheritance (is-a). But that relationship doesn't exist in this example!
1
0
Comments
Comments
On this page