October 2018
Intermediate to advanced
370 pages
9h 15m
English
When an object is created, all class members have to have an initial value. We can either initialize a property directly or the initial values can be provided by a constructor. A constructor is a special type of function that is used to initialize the properties of the class.
A constructor is invoked when the object is created, or, more specifically, when the space is allocated in the memory. This special function has two important characteristics:
In this section, we will learn about all of the different kinds of constructors that are provided by Kotlin. Let's start with the default ...
Read now
Unlock full access