Question: 1. Please use c++ for the following question. 2. PLEASE SHOW ALL OUTPUT. 3. Write CppUnitLite tests to verify class functionality. 4. Define a class

1. Please use c++ for the following question.

2. PLEASE SHOW ALL OUTPUT.

3. Write CppUnitLite tests to verify class functionality.

4. Define a class CharQueue with the public interface:

class CharQueue { public: CharQueue(); CharQueue(size_t size); CharQueue(const CharQueue& src); // copy constructor void enqueue(char ch); char dequeue(); bool isEmpty() const; void swap(CharQueue& src); int capacity() const; CharQueue& operator=(CharQueue src); }; 

Copy the public interface above into two different versions of CharQueue:

CharQueue1 with a char* array as the private data member. Use new to grow the array used for the queue as needed. Add other private member variables as needed to track size and position. Overload the copy constructor and assignment operator to and implement a deep copy.

CharQueue2 with a std::deque data member. Use the compiler generated copy constructor and assignment operator as a bitwise copy of the deque will perform a deep copy.

Place each class in two separate files named for the class. For example, for CharQueue1 place the class declaration in CharQueue1.h. Place the class definition in CharQueue1cpp.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!