Advertisements
From Cppreference – Type alias I know that following type alias declaration works:
using func = void (*) (int, int);
How does the equivalent for a function pointer to a class member look like?
>Solution :
You just need to add a qualifying class name before the *
.
For example using func = void (foo::*)(int, int);
Demo :
struct foo
{
void bar(int, int);
};
using func = void (foo::*)(int, int);
func ptr = &foo::bar;