In the study of quick-3.3, tracing the function of the Touch Event Distribution section found a rare (odd) notation:->*.
void Widget::p ushdownevent () { this->retain (); if (_toucheventcallback) { _toucheventcallback (this, Toucheventtype::began); } if (_toucheventlistener && _toucheventselector) { (_toucheventlistener->*_toucheventselector) ( This,touch_event_began); } This->release ();}
After investigation this is the legendary class function pointer, you write an example to test.
Fucktest.hclass fucktest{public:void shitFunction1 (void) {printf ("Liujianlog:call ShitFunction1");} void ShitFunction2 (void);};
#include <stdio.h> #include "FuckTest.h" typedef void (fucktest::* shitfunctionoutside) (void);//define a class member function int Main (int argc, const char * argv[]) {shitfunctionoutside shitfunctionoutside= &FuckTest::shitFunction1; Fucktest fucktest; (fucktest.*shitfunctionoutside) ();//here. * return 0;}
C + + class function pointers