Thanks, assumed there's something like this, but it still doesn't work:
CountsNode.h
Code:
#ifndef COUNTS_NODE_H
#define COUNTS_NODE_H
#include "RBNode.h"
#include "CNode.h"
class CNode;
class CountsNode : public RBNode
{
private:
int num_of_books;
CNode* customer;
public:
CountsNode(CNode* customer)
{
this->num_of_books = 1;
this->customer = customer;
};
};
#endif
CNode.h
Code:
#include "RBNode.h"
#include "Customer.h"
class CNode : public RBNode
{
private:
Customer* customer; // customer info object
public:
CNode(Customer* customer);
int GetKey() {return this->customer->id;};
void Print();
void CopyTo(RBNode* node);
};
Customer.h
Code:
#ifndef CUSTOMER_H
#define CUSTOMER_H
#include <iostream>
#include <string>
#include "RBNode.h"
#include "CountsNode.h"
using namespace std;
class CountsNode;
class Customer
{
public:
static const int MAX_BOOKS = 10;
Customer(int id, string familyName);
int GetCount() {return (this->count == NULL ? 0 : this->count->GetKey());};
private:
int id;
CountsNode* count;
string name;
friend class CNode;
};
#endif
I think the problem is with the includes (it's recursive). If I remove the include of CNode.h from CountsNode.h the build succeed but I can't it says that objects customer has no properties (which is logical since I didn't include it, just declare).