Better Programming

Advice for programmers.

Follow publication

Member-only story

Prefer Composition Over Inheritance

Nick Hodges
Better Programming
Published in
6 min readMar 2, 2020

Photo by Jason Wong on Unsplash

Out of Control Inheritance

A simple Pizza class
A descendant class
Yet another descendant
Even more descendants. This is starting to get complicated
OK, that’s a bit much

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Nick Hodges
Nick Hodges

Written by Nick Hodges

Just a guy with a bad pistachio addiction.

Responses (6)

Write a response