Main class
Queue class
but I got error. any hints for this? thanks!
void initCar(Queue&, Queue&);
Queue *q1, *q2; // Global variable
int main() {
initCar(*q1, *q2);
}
void initCar(Queue &q1, Queue &q2) {
Car c1 = Car("SJS1006Z","Toyota", "Saloon car");
Car c2 = Car("SFW6666E", "hyundai", "Taxi (Saloon)");
Car c3 = Car("SCF1006G","Mercedes", "Large Van");
Car c4 = Car("SBQ1006Z", "Puma", "Saloon Car");
q1.enqueue(c1);
q2.enqueue(c1);
q2.enqueue(c3);
q1.enqueue(c4);
q1.enqueue(c1);
q1.enqueue(c1);
q1.enqueue(c1);
q2.enqueue(c2);
q2.enqueue(c2);
}
Queue class
//Default constructor
#include "Car.h"
#include <iostream>
#include <string>
using namespace std;
const int Q_MAX_SIZE = 20;
class Queue {
private:
int size; // size of the queue
Car carQueue[Q_MAX_SIZE];
int front, rear;
public:
Queue();
~Queue();
};
Queue::Queue() { // default constructor
size = 0;
front = 0;
rear = Q_MAX_SIZE -1;
}
// Constructor for pointer ????
Queue::Queue*() {
size = 0;
front = 0;
rear = Q_MAX_SIZE -1;
}
but I got error. any hints for this? thanks!