我想SomeClass
从这个类之外调用一个类的私有函数:
class SomeClass {
private fun somePrivateFunction() {
//...
}
private fun somePrivateFunctionWithParams(text: String) {
//...
}
}
在代码的某处,我引用了SomeClass
对象:
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
如何从类外调用 Kotlin 中带参数和不带参数的私有函数?