Question
Consider the class Queue below: class Queue{ public: Queue(); void add(int item); int remove(); private: vector data; }; Intuitively, class Queue is similar to people
Consider the class Queue below:
class Queue{
public:
Queue();
void add(int item);
int remove();
private:
vector
};
Intuitively, class Queue is similar to people standing in a queue at a bank, where you have to join the queue at the end. As each persons transactions are processed, you move closer to the front of the queue. Similarly, the class Queuehas the following operations:
add() - adds an element to the end of the vector.
remove() - removes the element at the front of the vector
Provide a template version of the class Queue that can be used to process a queue of any data type. Provide only the interface of the template.
Step 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