Write the interface (.h file) of a class Counter containing: * A data member cou
ID: 3660489 • Letter: W
Question
Write the interface (.h file) of a class Counter containing: * A data member counter of type int. * A constructor that takes one int argument. * A function called increment that accepts no parameters and returns no value. * A function called decrement that accepts no parameters and returns no value. * A function called getValue that accepts no parameters. ------- ignore: Write the interface (.h file) of a class Counter containing: A data member counter of type int . A constructor that takes one int argument. A function called increment that accepts no parameters and returns no value. A function called decrement that accepts no parameters and returns no value. A function called getValue that accepts no parameters.Explanation / Answer
class Counter { private: int counter; int counterID; static int nCounters; int getCounterID(); // this will return some value , so would you like to someone reach this value from main ? if yes , then put it in public and if not then let it in private public: Counter(int); void getValue(); void increment(); void decrement(); }; your's written class: class Counter { private: void increment(); void decrement(); int getValue(); int getCounterID(int); public: int counter; int counterID; static int nCounters; Counter(int); }; Counter(int); void increment(); void decrement();
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.