Make Cost a C++ class, hide cost value, add const access method.