Example to show StatesPattern using C++