Copy this class declaration below into the top of your main.cpp file. The Button class represents a physical button. All it does is keep track of the number of times it has been pressed. class Button { private: int pressCount; // starts at 0 public : // CONSTRUCTOR Button(); // MUTATOR void Press(); // increments the pressCount // ACCESSOR int timesPressed(); }; Then do each of these steps: Write the definitions of the three member functions. Place this code below main(). Inside main(), create a single new variable of type Button. Then, add code that calls its mutator and accessor functions to demonstrate that it works as expected.
Explanation / Answer
#include #include using namespace std; class Button{ private: //not really necessary here since it is private by default for classes in Cpp pressCount;//starts at 0 public: //CONSTRUCTOR Button(); //MUTATOR void Press();//increments the pressCount //ACCESSOR int TimesPressed(); }; int main(){ Button test; cout