Hello, is it possible in Kotlin to do returns base...
# announcements
j
Hello, is it possible in Kotlin to do returns based on the configuration? For example,
Copy code
fun foo(useHttps: Boolean, conn: URLConnection): <Return type should either be HttpURLConnection/HttpURLsConnection> {
    // Logic here
    return URLConnection as HttpURLConnection/HttpURLsConnection // based on config?
}
j
Copy code
sealed class HttpConnection {
    class Url(val actual: HttpURLConnection): HttpConnection()
    class Urls(val actual: HttpURLsConnect): HttpConnect()
}
­čĹŹ 1
j
thanks