Hello. I haven't found an easy way to get at a int...
# language-proposals
k
Hello. I haven't found an easy way to get at a interface-delegated object. i.e.
Copy code
class A : B by C() {
	// need to access state inside the object C() returned, or functionality in C that isnt defined in B
}
Options I know of: 1) pass in a C instance to the constructor of A with a default, but this leaks implementation details to the API 2) use
A::class.java.getDeclaredField("\$\$delegate_0")
, but thats a mess and probably not reliable in the future 3) use inheritance, but I generally dislike abusing inheritance for problems that arent really hierarchies Unless I'm overlooking another option, it would be rather useful to give access to the delegate somehow (this.'$delegate'?), to enable using delegation over inheritance for problems that dont make sense w/ inheritance and really want a trait (i.e. A is not a type of C, but it is an implementation of B).