For some reason, my compiler won't allow me to use objects of another class as members of another class. Here is my code:
in Parameter.h:
class Parameter {
private:
string type;
string name;
public:
Parameter() {};
string toString();
friend class Predicate;
};
Then, in Predicate.h:
#include "Parameter.h"
class Predicate {
private:
Parameter lParam;
Parameter rParam;
string type;
public:
Predicate() {};
string toString();
friend class Parameter;
};
When I try to compile, I get errors saying that Parameter in Predicate.h does not name a type, and that it was not declared in that scope. I've tried putting the members in both private and public, as well as declaring the friend class in both private and public. I have also tried using pointers to the objects. What am I doing wrong? Thanks.