This is what i have, but i am not sure that this works. I am not sure if copying this way is efficient,and i couldn't figure a way to overload. when copying, i am giving both the same size, setting header and tail(indexes of first and last element) to the same place,and simply copying every element of the array into the other. overloading seems tricky here. i have done overloading before but never with circular array queues.
#include <iostream>
using namespace std;
class CircArrayQueue
{
private:
int *arr;
int head;
int tail;
int size;
CircArrayQueue()
{
arr = new int[5];
head = -1;
tail = -1;
}
CircArrayQueue(int s)
{
arr = new int[s];
head = -1;
tail = -1;
size = s;
}
void copyQueue(CircArrayQueue &object)
{
object.size = this->size;
for (int i = 0; i < this->size; i++)
{
object.arr[i] = this->arr[i];
}
object.head = this->head;
object.tail = this->tail;
}
~CircArrayQueue()
{
delete[] arr;
}
};