In other languages like Swift, there is the possibility of creating a function extension that adds a new constructor.
Something like this:
// base c
Another alternative is to just declare an extension function on the argument (or the first one if there are many):
// base class
class Whatever() {
...
}
// extension
fun String.toWhatever() = Whatever().apply { setPotato(this) }
fun main(args: Array) {
println("holi".toWhatever())
}
The pros:
Whatever
class doesn't have a Companion AND is not yours, so you couldn't add a Companion even if you wanted