Guest User

Untitled

a guest
Jan 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. data class MyValue(val value: Int) {
  2. operator fun plus(other: MyValue): MyValue {
  3. return MyValue(value + other.value)
  4. }
  5. }
  6.  
  7. public fun main(args: Array<String>) {
  8. val a = MyValue(1)
  9. val b = MyValue(2)
  10. println(a + b) // MyValue(value=3)
  11. }
Add Comment
Please, Sign In to add comment