July 2018
Intermediate to advanced
242 pages
8h 6m
English
The Delegation pattern is a great alternative to typical inheritance of classes. Delegation allows a certain class to be derived from another one or to implement an interface. However, under the hood, the derived class is not a subclass of the base class but the composition is used instead to provide the properties of the base class to the derived one. Whenever a request to the properties of the base class part is made, it is being redirected to a delegated object. This is comparable to subclasses deferring a request to parent classes. However, delegation not only allows us to achieve the same code reusability as inheritance does, it's also much more powerful and customizable. Kotlin makes the ...
Read now
Unlock full access