#include "Test.h"
int main ()
{
return 0;
}
int test::A()
{
bool x=B();
return 0;
}
bool B()
{
return -1;
}
The compiler shows me that 'B' was not declared in this scope.
First, I guessed the error is because that the member function of a class can only use other member functions or data member within the same class.
But it turns out that if I move the bool B() in front of int test::A(). There will be no error at all. Can anyone explain the reason further more for me
The reason might be that B() is not declared, while B is. Does the compiler not complain about opening curly just after bool B? Also, A must return value and test class closing curly must be followed by ;
error C2628: 'test' followed by 'bool' is illegal (did you forget a ';'?)
error C2470: 'B' : looks like a function definition, but there is no parameter list; skipping apparent body
error C3861: 'B': identifier not found