Skip to content

Instantly share code, notes, and snippets.

@mahata
Created January 8, 2018 05:01
Show Gist options
  • Save mahata/60ccb82bfa97fecfaa1477df0a7ea78a to your computer and use it in GitHub Desktop.
Save mahata/60ccb82bfa97fecfaa1477df0a7ea78a to your computer and use it in GitHub Desktop.
data class MyValue(val value: Int) {
operator fun plus(other: MyValue): MyValue {
return MyValue(value + other.value)
}
}
public fun main(args: Array<String>) {
val a = MyValue(1)
val b = MyValue(2)
println(a + b) // MyValue(value=3)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment