Delegation pattern

In software engineering, the delegation pattern is an object-oriented design pattern that allows object composition to achieve the same code reuse as inheritance.

The delegate is a helper object, but with the original context.

This is analogous to subclasses deferring requests to parent classes.

Some languages have special support for delegation built in.

For example, in the Kotlin programming language the by keyword[3] delegates to another object's interface: