DEV Community

Discussion on: Why composition is superior to inheritance as a way of sharing code

Collapse
 
jim_ej profile image
James Ellis-Jones

Hi Rui

Thanks for your response. My apologies that I misunderstood your limitation of the point you were making. I think we can then agree that in cases where you need polymorphism together with sharing code, inheritance has it's uses, but where polymorphism is not relevant, composition is preferable.