Is the NavHost.kt from Android file rewriting NavHost??
No.
How / why is this working??? Again, ABC() gives errors unless I comment out the latter ones.
You answered this yourself in your own question: "and each one takes different arguments". Your multiple ABC()
function definitions all have the same signature (same arguments, same return type). The NavHost()
function definitions each have a distinct signature, specifically different arguments.
So, had you tried:
fun ABC(something: String){
println("ABC")
}
fun ABC(anotherSomething: Int){
println("DEF")
}
fun ABC(andNow: Boolean, forSomething: Float, completelyDifferent: Double){
println("GHI")
}
...then all three of your ABC()
functions would have distinct signatures, and you should not get a Conflicting overloads
compiler error.
In Kotlin Multi Platform and JetPack Compose, why and how is NavHost importing from the same file with 9 versions of the same object, yet no errors?
Note that NavHost()
is a function, not an object.