Is it possible to forward declare a class and then use its member funcions? I'm trying to do this:
class Second;
class First{
private:
int x=0;
public:
void move(Second* s,int i){
s->setLine(i);
s->called(true);
}
int getX(){return x;}
}
class Second{
private:
int line=2;
bool cal=false;
public:
void setLine(int l){line = l;}
void called(bool b){cal=b}
bool interact(First* f){
if ((f->getX())>3)
return true;
else
return false;
}
}
My actual problem is a bit more complex and the funcions do more stuff but what I'm trying to do is have these two classes use eachother funcions and have them interact this way. Does anyone know if there is a way to do this?