August 2012
Intermediate to advanced
976 pages
30h 17m
English
We can also define a pointer that can point to a member function of a class. As with pointers to data members, the easiest way to form a pointer to member function is to use auto to deduce the type for us:
// pmf is a pointer that can point to a Screen member function that is const// that returns a char and takes no argumentsauto pmf = &Screen::get_cursor;
Like a pointer to data member, a pointer to a function member is declared using classname::*. Like any other function pointer (§ 6.7, p. 247), a pointer to member function specifies the return type and parameter list of the type of function to which this pointer can point. If the member function is a const member (§ 7.1.2, p. 258) or a reference member (§ ...
Read now
Unlock full access