Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a main program which must includes a minimum of 10 test cases to exercise the copy constructor and the overloaded operators /7 class counter
Write a main program which must includes a minimum of 10 test cases to exercise the copy constructor and the overloaded operators
/7 class counter header file pcounter.h #ifndefPCOUNTERH - - #define -PCOUNTER_A Taclass to hold a pointer to an integer counter class Counter public // constructors Counter(int k); Counter(const Counter& rhs); 7/ copy constructor overloading operators Counter& operator-(const Counter& rhs); // overloading of operator +-,-, and *= Counter& operator+(const Counter& rhs); Counter& operator--(const Counter& rhs); Counter& operator*-(const Counter& rhs); // overloading of binary operator +,-, * Counter operator+(const Counter& rhs) const; Counter operator-(const Counter& rhs) const; Counter operator (const Counter& rhs) const; // overloading of comparison operators-and != bool operator(const Counter& rhs) const; bool operator!-(const Counter& rhs) const; increment and decrement functions void incrementO; void decrementO; // get function int getCountO const; //destructor CounterO; private int* _p; // holds the pointer to a dynamically allocated integer count #endif //-PCOUNTER. HStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started