-
Book Overview & Buying
-
Table Of Contents
Android Programming for Beginners - Fourth Edition
By :
In this chapter, we finally get to the OOP stuff that we have been deferring throughout the entire book. It turns out it is not that complex, but there is a lot to know about classes. We had an introduction to encapsulation and practiced it, and a brief intro to inheritance and polymorphism (we will finish the lesson in Chapter 20). We also learned about properties, initializers, getters, and setters.
We saw that we don't need custom accessors for every property; we just use them when they add clarity, safety, or custom behavior. We learned about computed values that don't have a backing field, and each time the getter is used, a freshly computed value is returned.
We built a sound-based demo app because we don't just want 1970s-style programs with no sound. Finally, we closed the chapter with a quick rundown of the significant ways we can use classes in the context of all the Kotlin we already know, and it turns out classes are just as much a part of Kotlin as...