|
-
June 18th, 2008, 09:35 PM
#1
Forward Declaration
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|