Created
January 8, 2018 05:01
-
-
Save mahata/60ccb82bfa97fecfaa1477df0a7ea78a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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