[ create a new paste ] login | about

Link: http://codepad.org/RIyF5kFS    [ raw code | output | fork ]

C++, pasted on Jan 17:
1
2
3
4
5
6
7
8
9
10
#include <cstdio>

template<class T> void func(T obj) { T obj2 = obj; obj2(10, 20); }
void test(int a, int b) { std::printf("%d + %d = %d\n", a, b, a + b); }

int main(void) {
//func<void(int, int)>(test); // error
func<void(*)(int, int)>(test);
return 0;
}


Output:
1
10 + 20 = 30


Create a new paste based on this one


Comments: