???????????C++???????????????????this????????????????е?????ú??????????????????“???”????????this??????????β???????????C++????????棬????????????????????????
class A
{
public:
static void test()
{
m_staticA += 1;
}
private:
static int m_staticA;
int m_a
};
??????????test????????????m_staticA????????????????m_a????????????????????????????????ó????в????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????壬??C?л??????????????????????C++????зo??????????÷????????Щ?????????????????????????????????????
????????C++?????????????????this??????????????????
????typedef void (A::*FunPtr)();
????FunPtr p = A::hello;
????p();
???????????????????????????????this?????ζ?????????????p?????????????????????????????????
????typedef void (A::*FunPtr)();
????FunPtr p = A::hello;
????A a;
????A *pA = new A();
????(a.*p)();
????(pA->*p)();
???????????????????C++????????????л?????????????????????this????
????typedef void (A::*FunPtr)();
????FunPtr p = A::test;
????p();
???????????????????????????????????????????????????????????????????????????????????t????????ú???????????β????t???????????????????????????????
???????????
???????????????????????????????βα??????????????????
class A
{
public:
static void test(A *a)
{
a->m_a += 1;
}
void hello()
{
}
private:
static int m_staticA;
int m_a
};
??????????????????????????????????????????????????????????????????????????????????????????