function pointer

by gowtham 2010-02-15 10:15:34

A function pointer is a type of pointer in C, C++, D, and other C-like programming languages, as well as Fortran 2003. When dereferenced, a function pointer invokes a function, passing it zero or more arguments just like a normal function. In programming languages like C, function pointers can be used to simplify code by providing a simple way to select a function to execute based on run-time values.

Function objects, or functors, are similar to function pointers, and can be used in similar ways. A functor is an object of a class type that implements the function-call operator, allowing the object to be used within expressions using the same syntax as a function call. Functors are more powerful than simple function pointers, being able to contain their own data values, and allowing the programmer to emulate closures, among other uses.

Tagged in:

790
like
0
dislike
0
mail
flag

You must LOGIN to add comments