Playing with classes in C++