Conclusion

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In this lesson, you’ve scratched the surface of interfaces, which enable you to model behavior that isn’t connected to inheritance.

You learned:

  • That interfaces offer a flexible way to define blueprints for methods, properties, and requirements, allowing your code to adapt and be more reusable.
  • About abstract classes and how you can define methods and properties that child classes should adopt. However, a class can only extend one class since Kotlin does not support multiple inheritance.
  • That, unlike traditional inheritance, classes can adopt multiple interfaces as necessary.
  • About the Kotlin Standard Library, which provides us interfaces such as Comparable, which you used in this lesson.
  • You can define your own interfaces to create reusable code that defines the data or functionality to adopt.
  • That properties in abstract classes can maintain state while properties in interfaces can’t.
See forum comments
Download course materials from Github
Previous: Demo Next: Abstract Classes and Interfaces Quiz