Composition over Inheritance

aka Composite reuse Principle.

It is a OOP principle which encourages the usage of composition for code reuse instead of inheritance.

However, it is still a principle and a principle is just in principle.

Hence, this can be reframed better as -

If you are going to use inheritance - think again, chances are you need composition.

Trade-offs

References

Prefer composition over inheritance? - Stack Overflow


Backlinks