Created
May 12, 2021 08:20
-
-
Save channyeintun/f75d5712fe893c32c9b25cdab11916f9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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