mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 08:31:29 +00:00
22 lines
390 B
Kotlin
22 lines
390 B
Kotlin
class MyRange1() : Range<Int> {
|
|
override val start: Int
|
|
get() = 0
|
|
override val end: Int
|
|
get() = 0
|
|
override fun contains(item: Int) = true
|
|
}
|
|
|
|
class MyRange2() {
|
|
fun contains(item: Int) = true
|
|
}
|
|
|
|
fun box(): String {
|
|
if (1 in MyRange1()) {
|
|
if (1 in MyRange2()) {
|
|
return "OK"
|
|
}
|
|
return "fail 2"
|
|
}
|
|
return "fail 1"
|
|
}
|