Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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. H

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions

Question

4. Make sure students know if and when guessing is appropriate.

Answered: 1 week ago

Question

socialist egalitarianism which resulted in wage levelling;

Answered: 1 week ago

Question

soyuznye (all-Union, controlling enterprises directly from Moscow);

Answered: 1 week ago