implement list as a C++ class