cannot reference a variable in self written methods?

hi all~ i encounter a weird problem. i declare a public variable named aa in testApp.h, and a public method: void testFunc(). In testApp.cpp, when i try to use aa in testFunc, for example,
void testFunc()
{
aa=2;
}
there are compiling errors say: error C2065: ‘aa’: undeclared identifier

could anyone figure out why?

thanks in advance!

yup in your cpp it needs to be:

void testApp::testFunc()
{
aa=2;
}

without the testApp:: it is just a regular old function your in cpp file with no knowledge of testApp and it members.

[quote author=“theo”]yup in your cpp it needs to be:

void testApp::testFunc()
{
aa=2;
}

without the testApp:: it is just a regular old function your in cpp file with no knowledge of testApp and it members.[/quote]

got it! thank you theo~