A Callback is a Function represented by its Function Pointer whose invocation is deferred to its Caller, which treats it as a black box.

  • The callback is often passed to a function at runtime
  • All Higher-Order Functions utilize callbacks
  • Facilitates modularity and decoupling
classDiagram
	class Src {
	- callback : *fn
	+ setCallback(callback : *fn)
	+ sendMessage()
	}
	class Interface {
	- Src src
	+ wrapperFunction()
	- specialFunction()
	}
	Interface --> Src : src.setCallback(callback)
sequenceDiagram
	participant Src
	participant Interface
	Interface ->> Src: src.setCallback(wrapperFn)
	Src -->> Interface: Invoke callback()
	Interface ->> Interface: wrapperFn()
	Interface ->> Interface: specialFn() called within wrapperFn