Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
Inheritance establishes "IS A" relationship. Composition establishes "HAS A" relationship. Example-Car has an Engine and Car is a Automobile. Composition is easily achieved at runtime whereas inheritance provides its features at compile time.
23rd Mar 2017, 10:19 AM
Bhabesh Gogoi
Bhabesh Gogoi - avatar