Subscribe For Free Updates!

We'll not spam mate! We promise.

Apr 14, 2013

How do I declare a method that returns a pointer to a function?



How do I declare a method that returns a pointer to a function?

The following method takes parameter a char and returns a pointer to a function. To
avoid this heavy syntax, you may use a typedef.
struct A
{
void (*m(char))(int) { /* ... */ }
};
// ...
A a;
void (*pf)(int);
pf = a.m('a');

TechniqZone Socializer Widget
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment