recently while studying STL i came thru functors and facades
A typical use of a functor is in writing more intelligent callback functions. A callback in procedural languages, such as C, may be accomplished by using function pointers. However it can be difficult or awkward to pass state into or out of the callback function. This restriction also inhibits more dynamic behavior of the function. A functor solves those problems since the function is really a façade for a full object, thus it carries its own state.
I am not able to figure out what does state mean while they are saying it is difficult to pass the information into callback functions.
Moreover in facades is there something like interfaces with wrapovers written for them.
please give me some good examples as I am really interested to learn this aspect of C++
Edited 3 Years Ago by happygeek: fixed formatting