Skip to Content
Kotlin in Action
book

Kotlin in Action

by Svetlana Isakova, Dmitry Jemerov
February 2017
Intermediate to advanced content levelIntermediate to advanced
360 pages
11h 55m
English
Manning Publications
Content preview from Kotlin in Action

Chapter 7. Operator overloading and other conventions

This chapter covers

  • Operator overloading
  • Conventions: special-named functions supporting various operations
  • Delegated properties

As you know, Java has several language features tied to specific classes in the standard library. For example, objects that implement java.lang.Iterable can be used in for loops, and objects that implement java.lang.AutoCloseable can be used in try-with-resources statements.

Kotlin has a number of features that work in a similar way, where specific language constructs are implemented by calling functions that you define in your own code. But instead of being tied to specific types, in Kotlin those features are tied to functions with specific names. For example, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kotlin in Action, Second Edition

Kotlin in Action, Second Edition

Roman Elizarov, Svetlana Isakova, Sebastian Aigner
Java to Kotlin

Java to Kotlin

Duncan McGregor, Nat Pryce
Head First Kotlin

Head First Kotlin

Dawn Griffiths, David Griffiths

Publisher Resources

ISBN: 9781617293290Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link