I am using a header file to declare a class for a queue, which is just a dynamic array and the functions to insert and remove as well as grow the array. The problem is that the compiler gives me this error:
queue.h:7: error: expected ‘,’ or ‘...’ before ‘class’
queue.h:9: error: expected `)' before ‘;’ token
#ifndef __QUEUE_H__
#define __QUEUE_H__
#include <iostream>
#include "p1.h"
class emptyQueue {
// OVERVIEW: an exception class
};
class Queue {
// OVERVIEW: contains a dynamic array of spaces.
public:
// Operational methods
bool isEmpty();
// EFFECTS: returns true if list is empy, false otherwise
void insert(space *o);
// MODIFIES this
// EFFECTS inserts o at the front of the list
space *remove();
// MODIFIES this
// EFFECTS removes and returns first object from non-empty list
// throws an instance of emptyList if empty
// Maintenance methods
Queue(); // ctor
~Queue(); // dtor
private:
// A private type
int numElts;
int maxElts;
space** queue;
// Utility methods
//Increases the size of the queue.
void makeLarger();
};
#endif /* __QUEUE_H__ */
I just can't imagine what I need to change before my exception class.
yeah, I'll do that. This is a just a template that I was using from one of my previous classes, so it's far from perfect. Doesn't even have a copy ctor or assignment operator.