The Four Pillars of Object-Oriented Programming

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 ...

Get Hands-On Object-Oriented Programming with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.