June 2018
Intermediate to advanced
310 pages
6h 32m
English
So, animals have decided to have a choir of their own. The cat was elected as the conductor of the choir (it didn't like to sing anyway).
The problem is that animals escaped from the Java world, and don't have a common interface. Instead, each has a different method to make a sound:
class Bat { fun screech() { println("Eeeeeee") }}class Turkey { fun gobble() { println("Gob-gob") }}class Dog { fun bark() { println("Woof") } fun howl() { println("Auuuu") }}
Luckily, the cat was elected not only because it was vocally challenged, but also because it was smart enough to follow this chapter until now. So it knows that in the Kotlin world, it can accept functions:
class Cat { ... fun joinChoir(whatToCall: ()->Unit) { ... } fun leaveChoir ...
Read now
Unlock full access