GotToDream
June 18th, 2008, 09:35 PM
I have a class Rule and another class Condition. Rule.hh file has a pointer declaration to Condition class. The definition looks like -
//--------------------- Rule.hh ------------------
#ifndef __RULE_HH__
#define __RULE_HH__
#include <iostream>
#include "Condition.hh"
class Condition;
class Rule {
public:
void Condition( const char* );
private:
Condition *condition;
}
//----------------------- Rule.cc -------------
void
Rule::Condition( const char *c) {
condition = new Condition( c );
}
And then Condition class is defined in Condition.hh file.
Problem - Even though I forward declare Condition class in Rule.hh, I am getting an error while compiling -
"ISO C++ forbids declaration of 'Condition' with no type"
"expected ';' before '*' token"
Can someone please help me solve this problem?
//--------------------- Rule.hh ------------------
#ifndef __RULE_HH__
#define __RULE_HH__
#include <iostream>
#include "Condition.hh"
class Condition;
class Rule {
public:
void Condition( const char* );
private:
Condition *condition;
}
//----------------------- Rule.cc -------------
void
Rule::Condition( const char *c) {
condition = new Condition( c );
}
And then Condition class is defined in Condition.hh file.
Problem - Even though I forward declare Condition class in Rule.hh, I am getting an error while compiling -
"ISO C++ forbids declaration of 'Condition' with no type"
"expected ';' before '*' token"
Can someone please help me solve this problem?