Greetings, everyone I need help with this question. I will rate your answer. Que
ID: 3710654 • Letter: G
Question
Greetings, everyone
I need help with this question. I will rate your answer.
Question 20 Not yet graded /25 pts Define a class (give the class declaration) for a type called "CounterType". An object of this type is used to count things, so it records a count that is a nonnegative whole number. Include a prototype for the default constructor that sets the counter to zero. Also include prototypes for two member functions to increase the count by 1 and to decrease the count by 1:you may call these functions whatever name you wish, but make sure the names reflect their purpose counter to zero. Also Your Answer:Explanation / Answer
Answer:
class CounterType {
private:
int count;
public:
CounterType() {
count = 0;
}
void increase() {
count++;
}
void decrease() {
count--;
}
};
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.