I have got these errors :
Expected ( before QueType
Expected { before QueType
expected constructor , destructor or type conversion before { Token
I need to inherit the constructor from QueueType
QueueType.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#ifndef QUETYPE_H
#define QUETYPE_H
QueType.cpp
[code]
#include "QueType.h"
template<class ItemType>
QueType<ItemType>::QueType(int max)
// Paramaterized class constructor
// Post: maxQue, front, and rear have been initialized.
// The array to hold the queue elements has been dynamically allocated.
{
maxQue = max + 1;
front = maxQue - 1;
rear = maxQue - 1;
size = 0;
items = new ItemType[maxQue];
}
template<class ItemType>
QueType<ItemType>::QueType() // Default class constructor
// Post: maxQue, front, and rear have been initialized.
// The array to hold the queue elements has been dynamically allocated.
{
maxQue = 501;
front = maxQue - 1;
rear = maxQue - 1;
size = 0;
items = new ItemType[maxQue];
}
template<class ItemType>
QueType<ItemType>::~QueType() // Class destructor
{
delete [] items;
}
template<class ItemType>
void QueType<ItemType>::MakeEmpty()
// Post: front and rear have been reset to the empty state
// and size has been set to zero.
{
front = maxQue - 1;
rear = maxQue - 1;
size = 0;
}
template<class ItemType>
bool QueType<ItemType>::IsEmpty() const
// Returns true if the queue is empty; false otherwise.
{
return (rear == front);
}
template<class ItemType>
bool QueType<ItemType>::IsFull() const
// Returns true if the queue is full; false otherwise.
{
return ((rear + 1) % maxQue == front);
}
template<class ItemType>
void QueType<ItemType>::Enqueue(ItemType newItem)
// Post: newItem is at the rear of the queue.
{
rear = (rear +1) % maxQue;
items[rear] = newItem;
size++;
}
template<class ItemType>
void QueType<ItemType>::Dequeue(ItemType& item)
// Post: The front of the queue has been removed and a copy returned in item.
{
front = (front + 1) % maxQue;
item = items[front];
size--;
}
template<class ItemType>
int QueType<ItemType>::QueSize() const
{
return size;
}
|
waitingCustomerQueueType.cpp
1 2 3 4 5 6 7 8 9 10 11
|
#include "waitingCustomerQueueType.h"
waitingCustomerQueueType::waitingCustomerQueueType(int taille): QueType<JobType>QueType(taille)
{
//ctor
}
waitingCustomerQueueType::~waitingCustomerQueueType()
{
//dtor
}
|
QueType.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#ifndef QUEUE_H
#define QUEUE_H
// File: queue1.h
// Header file for Queue ADT
// Class is templated; items are in dynamically allocated storage.
template<class ItemType>
class QueType
{
public:
QueType();
// Class constructor.
// Because there is a default constructor, the precondition that the queue
// has been initialized is omitted.
QueType(int max);
// Parameterized class constructor.
~QueType();
// Class destructor.
void MakeEmpty();
// Function: Initializes the queue to an empty state.
// Post: Queue is empty.
bool IsEmpty() const;
// Function: Determines whether the queue is empty.
// Post: Function value = (queue is empty)
bool IsFull() const;
// Function: Determines whether the queue is full.
// Post: Function value = (queue is full)
void Enqueue(ItemType newItem);
// Function: Adds newItem to the rear of the queue.
// Pre: Queue is not full.
// Post: newItem is at the rear of the queue.
void Dequeue(ItemType& item);
// Function: Removes front item from the queue and returns it in item.
// Pre: Queue is not empty.
// Post: Front element has been removed from the queue.
// item is a copy of the removed element.
int QueSize() const;
// Function: Returns the number of elements in the queue
private:
int front, rear;
int size;
ItemType* items;
int maxQue;
};
#endif // QUEUE_H
#endif // QUETYPE_H
|
waitingCustomerQueueinh.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#ifndef WAITINGCUSTOMERQUEUETYPE_H
#define WAITINGCUSTOMERQUEUETYPE_H
#include "QueType.h"
#include "JobType.h"
class waitingCustomerQueueType : public QueType <JobType>
{
public:
waitingCustomerQueueType(int);
void updateWaitingQueueType();
virtual ~waitingCustomerQueueType();
protected:
private:
};
#endif // WAITINGCUSTOMERQUEUETYPE_H
|
My error is in this line on the cpp file of waitingCustomerQueueType.cpp
1 2 3 4
|
waitingCustomerQueueType::waitingCustomerQueueType():QueType<JobType>QueType()
{
//ctor
}
|
here is the error that I got
Expected ( before QueType
Expected { before QueType
expected constructor , destructor or type conversion before { Token
Thank you