please help It says when creating the object of ArrayCharQueue that I can't because it is abstract and am not understanding why please help
//array based charqueue
// must use abstract base class char queue
// must be dynamically allocated
#include "charqueue.h"
#include <iostream>
#include <cstdlib>
class ArrayCharQueue : public CharQueue
{
public:
ArrayCharQueue();// constructor
//copy constructor
ArrayCharQueue(ArrayCharQueue& souce);
//destructor
virtual ~ArrayCharQueue();
// Methods
bool isEmpty() ;
void enqueue(const char newItem);
char dequeue(void);
char getFront(void);
private:
int arraySize;
char *array;
int front;
int back;
};
// end class ArrayCharQueue()
//end of header
#include "arraycharqueue.h"
using namespace std;
//constructors
ArrayCharQueue::ArrayCharQueue()
{
front = 0;
back = 0;
//count = 0;
arraySize = 0;
array = new char[arraySize];
}//end default constructor
ArrayCharQueue::ArrayCharQueue(ArrayCharQueue& souce)
{
}
ArrayCharQueue::~ArrayCharQueue()
{
}
//methods
bool ArrayCharQueue::isEmpty()
{
return arraySize == 0;
}
void ArrayCharQueue::enqueue(const char newItem)
{
arraySize = arraySize+1;
char *temp = array;
array = new char[arraySize];
for(int i =0;i<arraySize-1;i++)
{
array[i] = temp[i];
}
delete [] temp;
array[arraySize-1] = newItem;
back = arraySize-1;
}
char ArrayCharQueue::dequeue(void)
{
if(isEmpty())
{
cout << "Error Array is Empty\n";
exit(1);
}
char *temp = array;
char data = array[front];
arraySize = arraySize-1;
array = new char[arraySize];
for(int i=0;i<arraySize;i++)
{
array[i] = temp[i+1];
}
delete []temp;
back = arraySize-1;
return data;
}
char ArrayCharQueue::getFront()
{
return array[front];
}
again thanks for any help