Created
June 17, 2021 04:01
-
-
Save CheolhoJeon/38f05f33d7328a9482a072d45856c715 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
package chap5.CompanionObjects | |
import atomictest.eq | |
class Counted { | |
companion object { | |
private var count = 0 | |
} | |
private val id = count++ | |
override fun toString() = "#$id" | |
} | |
fun main() { | |
List(4) { Counted() } eq "[#0, #1, #2, #3]" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment