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 data;

};

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

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!