From the course: Build Spring Boot Apps with the Kotlin Programming Language

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Creating and implementing interfaces

Creating and implementing interfaces

- Hello again, we're now at chapter 14, and in this chapter we're going to talk about extending classes and interfaces. I've switched back to the code we were using in exercise two, that was as of the end of chapter 12, because I want to use the case study here, our booking system for theater, to work with in this chapter. So let's start by creating an interface for a booking system. I'm going to create a new file, I think. In fact, let's rename this file, first of all, to the theater file, because it contains our theater class, also the seat class, but I think might be a sensible name for that, so we'll choose Refactor and Rename file. Remember, the file and the classes in the file don't have to have the same name. So we'll call that one Theater, and then let's create a second Kotlin file, and we'll call this one Bookings. Okay, so our booking system, I want to define the interface for a booking manager. So the way you would do that is, well, it's pretty straightforward. We use the…

Contents