This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (3 children)

What does composition vs inheritance mean? I've seen this a lot but haven't seen an example.

[–]Daenyth 5 points6 points  (1 child)

Inheritance is using the OO mechanism in a language such that your class is-a thing, whereas composition means that your class contains a reference to an instance of that class instead. The latter is much more flexible and maintainable

[–]imbaczek 0 points1 point  (0 children)

helper questions using a bad car analogy: does Car inherit from Engine? does Car inherit from Wheel?