Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我将扩展函数的访问修饰符更改为 会发生什么private?它有什么作用吗?有关系吗?!
private
private fun String.myExtensionFunction() { // ... }
fun String.myExtensionFunction() { // ... }
扩展方法只会在声明它的类/文件中看到。
如果没有私有,扩展方法将是公共的,并且可以从外部调用。