Upcasting class
Taking an object reference and treating it as a reference to its base type is called upcasting.
62 posts · page 4 of 8
Taking an object reference and treating it as a reference to its base type is called upcasting.
An abstract class is like an ordinary class except one or more functions or properties is incomplete - ie. a function without implementation or a property without initialisation.
Inheritance is a mechanism for creating a new class by reusing and modifying an existing class.
A constructor is a special function that creates a new object. Using var or val in the parameter list makes them accessible from outside the object.
Recursion is the programming technique of calling the function within the same function. A recursive function uses the result from the previous recursive call. The perfect example for recursion is fi…
What exactly is local function? It was new to me in Kotlin and thought it is interesting to dig deeper. In a normal class, we have many functions within a class - the functions have names so that we…
fold() combines all elements of a list, in order to generate a single result. Here is how we can use fold() to calculate the sum -
What is Sequence? A Kotlin Sequence is like a List, but you can only iterate. You cannot index into Sequence. And this restriction produces very efficient chained operations.