You might have already heard about the delegation pattern or at least used it without even knowing it had a name. It allows a type to forward one or more of its method calls to a different type. Therefore, you need two types to achieve this—the delegate and the delegator.
This might sound like it's a proxy pattern, but it isn't. A proxy pattern is meant to provide a placeholder for an instance to get full control while accessing it. Let's say you are writing a UI framework and you start where your abstraction is UIElement. Each of the components defines a getHeight and getWidth. Consider the following diagram:
The following code block shows you the unified modeling language (UML) translated into Kotlin. We defined the UIElement interface with both the Panel and Rectangle classes inheriting the following:
interface UIElement { ...