I am having trouble making a structure where Queue is a child of QueueItem, I get a "expected class name" error.
I'm doing this in xCode.
I have 4 files:
Queue.cpp, Queue.h, QueueItem.cpp,QueueItem.h
For QueueItem.cpp I have:
Code:
#include "QueueItem.h"
class QueueItem
{
public:
virtual void print() = 0;
};
QueueItem.h
Code:
#ifndef __Practice__QueueItem__
#define __Practice__QueueItem__
#include <stdio.h>
#endif
Queue.cpp
Code:
#include "Queue.h"
class Queue : public QueueItem // I get "expected class" error here
{
void print();
};
and Queue.h
Code:
#ifndef __Practice__Queue__
#define __Practice__Queue__
#include <stdio.h>
#include "QueueItem.h"
#endif
So I get an error at "class Queue : public QueueItem", but I have included the QueueItem.h header in the Queue header so I don't get why it says it's expecting a class.
I also tried putting the include QueueItem directly into the Queue c++ code and that didn't work.