Refactor gravity example

This change makes the likelihood and the qoi sublass the appropriate queso base classes.  The functionality is the same but the style is more oriented towards C++, rather than the C-style-like passing around of function pointers to queso classes.

@nicholasmalaya Fancy giving this one a once-over?
Shouldn't we update the licence year? (and in a few weeks, two years) If agreed, I can start a separate ticket.