Sanitize use of `class` / `struct`.

Mixing `class` and `struct` can cause linking problems with MSVC. See these links for refence:
https://alfps.wordpress.com/2010/06/22/cppx-is-c4099-really-a-sillywarning-disabling-msvc-sillywarnings/#decoration
http://stackoverflow.com/a/468558/608954

This PR changes all internal objects to classes if they have at least one method.