Skip to content

Instantly share code, notes, and snippets.

@channyeintun
Created May 12, 2021 08:20
Show Gist options
  • Select an option

  • Save channyeintun/f75d5712fe893c32c9b25cdab11916f9 to your computer and use it in GitHub Desktop.

Select an option

Save channyeintun/f75d5712fe893c32c9b25cdab11916f9 to your computer and use it in GitHub Desktop.
package main
data class Num(var value:Int)
infix fun Num.plus(num:Int)=value + num
operator fun Num.plus(num:Num)=value+num.value
fun main(){
var result=Num(4) plus 3
var result2=Num(1) + Num(3)
println(result)
println(result2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment