I have a problem, the Rectangle class is not working properly in TwoDimTree.h For example, "Rectangle Extent;" seems like working ,but when i try to use it it says no member class found.
I want to use it like "Extent.get_Top;" , but i cant make it.
Also in the error list i got. Error 7 error C2027: use of undefined type 'Rectangle'
My headers are below.I really couldn't find my mistake.Thanks for the help.
My TwoDimTree.h
#include <string>
#include "Rectangle.h"
#include "LinkedList.h"
using namespace std;
class TwoDimTreeNode
{
public:
TwoDimTreeNode(Rectangle,TwoDimTreeNode*,TwoDimTreeNode*,TwoDimTreeNode*,TwoDimTreeNode*,LinkedList<Rectangle>,LinkedList<Rectangle>);
TwoDimTreeNode(Rectangle);
Rectangle get_Extent();
private:
Rectangle Extent;
LinkedList <Rectangle> Vertical;
LinkedList <Rectangle> Horizontal;
TwoDimTreeNode*TopLeft;
TwoDimTreeNode*TopRight;
TwoDimTreeNode*BottomLeft;
TwoDimTreeNode*BottomRight;
friend class Rectangle;
friend class LinkedList<Rectangle>;
};
My Rectangle.h
#include <string>
#include "TwoDimTreeNode.h"
#include "LinkedList.h"
using namespace std;
class Rectangle {
public:
Rectangle(int,int,int,int);
int get_Top();
void set_Top(int);
private:
int Top;
int Bottom;
int Right;
int Left;
friend class TwoDimTreeNode;
friend class LinkedList<Rectangle>;
};
My Linkedlist.h
#include <string>
#include "Rectangle.h"
#include "TwoDimTreeNode.h"
using namespace std;
template <class Object>
struct node
{
Object element;
node*next;
node(const Object & theElement = Object(),node*n=NULL)
:element(theElement), next(n){}
friend class Rectangle;
friend class TwoDimTreeNode;
};
template <class Object>
class LinkedList
{
public:
LinkedList();
int get_Length();
Object search(int,int);
bool check_Rectangle(Object);
private:
int length;
node<Object>*head;
};