Inline class member function definitions are parsed as if they appeared right after the class definition. Of course B
isn't defined at that point. So move the member function definition for A::getctxt
out of the definition of class A
:
class B;
class A { int getctxt(); /* ... */ };
class B { /* ... */ };
int A::getctxt()
{
b->getctxt1(); // at this point, *b has complete type!
return -35;
}