Add example.cpp

example.cpp contains idea about how to use function pointer.