Question: C++: Define a class counterType to implement a counter. Your class must have a private data member counter of type int and functions to set
C++: Define a class counterType to implement a counter. Your class must have a private data member counter of type int and functions to set counter to the value specified by the user, initialize counter to 0, retrieve the value of counter, and increment and decrement counter by one. The value of counter must be nonnegative. Give an example of a short program showing that the counter class works.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
