October 2019
Intermediate to advanced
434 pages
11h 54m
English
In some situations, we may not want to rely on the default getter/setter that Kotlin provides. In those cases, we can provide our own custom accessors for any of our defined properties. For mutable variables, we can provide both custom getters and setters, while for read-only variables we can only provide a custom getter. To illustrate this, let's start by adding a custom setter for the description property, as follows:
class Course(courseTitle: String) { ... var description = ""}
class Course ...Read now
Unlock full access