I searched the Internet and found that some people said that non-static member function can access static member function or data. Then I wrote a program to verify it.
#include <iostream>
class test
{
public:
static int a;
void printa()
{
std::cout<<a;
}
};
int main(int argc, const char * argv[])
{
test m;
m.printa();
return 0;
}
The code generate linker errors!
Undefined symbols for architecture x86_64:
"test::a", referenced from:
test::printa() in main.o