static静态函数调用非静态变量的方法
//Test.h
#ifndef TEST_H
#define TEST_H
#include <iostream>
using namespace std;
class Test
{
private:
static void FuncA();
static Test*s_g;
unsigned Block(int i);
int m_num;
public:
Test();
~Test();
};
#endif
//Test.cpp
#include "Test.h"
Test* Test::s_g= NULL;
Test::Test()
{
s_g= this;
m_num = 0;
FuncA();
}
Test::~Test()
{
}
void Test::FuncA()
{
s_g->Block(s_g->m_num);//调用非静态函数
s_g->m_num += 1;//调用非静态变量
return;
}
unsigned Block(int i)
{
printf("i:%d\n",i);
}