This chapter will continue on from Chapter 2, Introduction to Object-Oriented Programming, in which we discussed the basic concepts of object-oriented programming. In this chapter, we will discuss the four pillars of object-oriented programming, which are encapsulation, inheritance, abstraction, and polymorphism. We will try to understand what inheritance is and look at the different types of inheritance that are provided by Kotlin. We will also learn how inheritance can help us to write clean and reusable code. After that, we will discuss encapsulation, before moving on to taking a closer look at the polymorphism technique. Finally, we will take a look at some of the benefits of abstraction and how interface and abstract classes can help us to write bug-free applications.
The following topics will be covered in this chapter:
- Inheritance...