How would you implement the State pattern in C++ to manage the different operational modes of a medical device?