Skip to content

Instantly share code, notes, and snippets.

@fortheday
Created January 29, 2018 05:24
Show Gist options
  • Save fortheday/144df273fe982674823474ff9061c671 to your computer and use it in GitHub Desktop.
Save fortheday/144df273fe982674823474ff9061c671 to your computer and use it in GitHub Desktop.
int add(int a, int b) { return a + b; }
void FuncRefTest()
{
int(*pfnAdd)(int a, int b) = add;
pfnAdd(1, 2);
(*pfnAdd)(1, 2);
pfnAdd = add; // ok
int(&rfnAdd)(int a, int b) = add;
rfnAdd(1, 2);
rfnAdd = add; // compile error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment