Sealed classes and enumeration

So far in this book, we have learned about different types of classes, including normal and abstract classes. The main purpose of writing classes is to allow other classes to extend each other and to take full advantage of code reusability and maintainability. These classes can be called and used in any part of the application. For example, if class A is declared in the File1.kt file and class B is declared in the File2.kt file, then class B or any other class can extend class A. This is a normal practice and is referred to as inheritance. However, Kotlin provides another type of class that is restricted to limited classes and cannot be further inherited. These classes are called sealed classes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.77.63