mardi 17 décembre 2019

How to call private functions in Kotlin [duplicate]

This question already has an answer here:

I want to call a private functions of class SomeClass:

class SomeClass {
    private fun somePrivateFunction() {
        //...
    }

    private fun somePrivateFunctionWithParams(text: String) {
        //...
    }
}

Somewhere in the code I have a reference to SomeClass object:

val someClass = SomeClass()
// how can I call the private function `somePrivateFunction()` from here?
// how can I call the private function `somePrivateFunctionWithParams("some text")` from? here

How to call private functions with params and without params in Kotlin?





Aucun commentaire:

Enregistrer un commentaire