Skip to content

Instantly share code, notes, and snippets.

@CheolhoJeon
Created June 14, 2021 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CheolhoJeon/d55e9258b0e7236d5df10e89428e085e to your computer and use it in GitHub Desktop.
Save CheolhoJeon/d55e9258b0e7236d5df10e89428e085e to your computer and use it in GitHub Desktop.
package chap5.Object
import atomictest.eq
object JustOne {
val n = 2
fun f() = n * 10
fun g() = this.n * 20 // [1]
}
fun main() {
// val x = JustOne() // Error
JustOne.n eq 2
JustOne.f() eq 20
JustOne.g() eq 40
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment