I wrote two classes with these dependencies.
//a.h
class B:
class A{
B *b ;
A() { b = new B(this);}
print();
}
// b.h
class A;
class B{
A* a;
B(A *_a){ this->a = _a }
void foo() { a->print(); } // here i have error : use of undefined type a
}
If I comment 'a->print()' the code compiles and the other function works, but when I use the pointer of class A in class B, I'm getting this error:
"use of undefined type a"
Can anyone solve my problem?
Thanks