Why can't I access the outer class's properties on an instance of an inner class?
class A(val id: String) {
inner class B {}
}
fun test() {
val a = A("test")
val b = a.B()
aid(a)
bid(b)
}
fun aid(a:A): String = a.id
fun bid(b:A.B): String = b.id //Unresolved reference: id
In this example, b.id fails to compile.
I gather that I have to add a getter on B that returns this@A.id. But why?