This is a very wide topic, It’s a programming paradigm. With modern C++ has gain attention again. Next link presents “just a simple” example how can be used in C++.
object A calls a function on object B
A->B
object A calls a function on object B and then B calls an function on object A
A->B->A
Some examples how to use std::function<…>