Write the definition of a class counter containing: an instance variable counter of type int, initialized to 0. a method called increment that adds one to the instance variable counter. it does not accept parameters or return a value. a method called getvalue that doesn't accept any parameters. it returns the value of the instance variable counter.

Respuesta :

tonb
class Counter
{
   private:
      int counter = 0;
   public: 
      void Increment() { counter++; }
      int GetValue() { return counter; }
};