To be pedantic, that is not quite composition - I've made this exact mistake before too. Composition is where you have a function f o g (o being the traditional mathematical notation for composition), where (f o g)(a) = b satisfies g(f(a)) = b.
Composition is a useful tool, and so is writing functions like this, but they are two different ideas.
https://en.wikipedia.org/wiki/Composition_over_inheritance