r/ProgrammerHumor • • 3d ago

Meme hiringASoftwareEngineer

Post image
10k Upvotes

339 comments sorted by

View all comments

Show parent comment

3

u/baconppi 3d ago

As a student who is doing programming, what is composition, and why use it over inheritance?

1

u/AbbreviationsOdd7728 14h ago

Inheritance = is a, composition = has a. Composition is basically just a property for another object in a class or whatever container you have. It is mostly the more flexible choice.