Ask Question

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.

+3
Answers (1)
  1. 10 May, 03:20
    0
    Class Counter

    {

    private:

    int counter = 0;

    public:

    void Increment () { counter++; }

    int GetValue () { return counter; }

    };
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write the definition of a class counter containing: an instance variable counter of type int, initialized to 0. a method called increment ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers