Kotlin Illustrated: Abstract and Open Classes in Kotlin
The article discusses the concept of abstract and open classes in Kotlin, focusing on how they can be used to create subtypes and accomplish code sharing. It starts by explaining the need for different engine sounds in cars and how the interface approach used for animals in a previous chapter can be applied to cars as well. However, the article highlights the undesirable changes that occur when converting a class into an interface. Instead, it introduces abstract classes as a solution. Abstract classes are similar to interfaces but can include private functions, properties, and state. The article provides an example of an abstract class for modeling a car and explains how to create subtypes from it. It also mentions that abstract classes cannot be directly instantiated. This article is relevant for developers interested in understanding abstract and open classes in Kotlin and how they can be used in their programming projects.