
72

使用Kotlin高效地开发Android App(四) - 简书
source link: https://www.jianshu.com/p/c5d5bc0427b9?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

一. 运算符重载 在Kotlin的世界里,我们可以重载算数运算符,包括一元运算符、二元运算符和复合赋值运算符。 使用operator修饰符来修饰特定函数名的函数,这些函数可以是成员函数也可以是扩展函数。 例如,在RxKotlin的disposable.kt中有这样一个方法。 它满足两个条件: 使用operator进行修饰 使用了plusAssign作为函数名 所以可以重载复合运算符+= , ...
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK