Define a class for a type called CounterType. An object of thistype is used to count things, so it records a count that is anon-negative whole number. Include a mutator function (setCount())that sets the counter to a count given as an argument. Includemember functions to increase the count by one (inCount()) and todecrease the count by one (decCount()). Be sure that no memberfunction allows the counter to become negative. Also, include amember function that returns the current count value(getCount()).

/* Counter class */

#include <iostream>

using std::cout;
using std::endl;

class CounterType {
   // Write the declaration for the class

};

int main()
{
   CounterType ctr;
   ctr.setCount(1); // Set count to 1
   cout << ctr.getCount() << endl; // Outputscount
   ctr.incCount(); // Increments count
   cout << ctr.getCount() << endl; // Verifyincrement worked correctly
   ctr.decCount(); // Decrement count
   ctr.decCount(); // Decrement count
   cout << ctr.getCount() << endl; // Verifydecrement worked correctly
   ctr.decCount(); // Decrement count // Should printInvalid Operation
   return 0;

}

// Define the class member functions as specified by the test inmain() – setCount(), getCount(), incCount(), decCount().