Improved C++ Code

Changes to the C++ code to conform to best practices and at the same
time optimization by removing virtual inheritance and replacing it with
multiple inheritance.