Created
August 31, 2013 17:35
-
-
Save ofan/6399618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int doAdd(int (*call)(int,int)) { | |
return call(1,2); | |
} | |
int main() { | |
struct Add { | |
static int add(int a, int b) { | |
return a + b; | |
} | |
}; | |
std::cout << doAdd(Add::add) << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
int doAdd(int (_call)(int,int)) {
struct closure{
closure(int (_c)(int,int)):m_callback(c);
}