A delegate is a helper object used by another object. The delegator may send the delegate certain messages, and provide a default implementation when there is no delegate or the delegate does not respond to a message. This pattern is heavily used in Cocoa framework on Mac OS X. See also wp:Delegation pattern.

Objects responsibilities:

Delegator:

 Keep an optional delegate instance.
 Implement "operation" method, returning the delegate "thing" if the delegate respond to "thing", or the string "default implementation".
Delegate:

 Implement "thing" and return the string "delegate implementation"
Show how objects are created and used. First, without a delegate, then with a delegate that does not implement "thing", and last with a delegate that implements "thing".

// version 1.1.51
 
interface Thingable {
    fun thing(): String?
}
 
class Delegate(val responds: Boolean) : Thingable {
    override fun thing() = if (responds) "delegate implementation" else null
}
 
class Delegator(d: Delegate) : Thingable by d {
    fun operation() = thing() ?: "default implementation"
}
 
fun main(args: Array<String>) {
    // delegate doesn't respond to 'thing'
    val d = Delegate(false)
    val dd = Delegator(d)
    println(dd.operation())
 
    // delegate responds to 'thing'
    val d2 = Delegate(true)
    val dd2 = Delegator(d2)
    println(dd2.operation())
}