最佳答案
在 Kotlin 编写扩展方法很容易:
class A { }
class B {
fun A.newFunction() { ... }
}
但是有没有什么方法可以创建扩展变量呢? 比如:
class B {
var A.someCounter: Int = 0
}