Making games is an art and as such, it has a high degree of creative freedom, which means that there is no one single way to reach your goal.
On one hand, traditional hierarchy-based games development is quite intuitive as you can see in the next diagram:
However, as the game grows, the class hierarchies become more annoying and hardly reusable.
On the other hand, a viable alternative to destroy that pyramid from hell is component-based development. In this way, we would have, for instance, our T-Rex class working as a container for a series of behaviors called components. The advantage of this is that those ...