Reputation: 5459
I want to "add" a field to a companion object without changing the companion object itself, using an implicit. In the following example, I want to be able to access the property "name" from object A. Is this possible?
implicit def a2b(???): ??? = B
object A
class A
object B {
val name = "Bob"
}
Upvotes: 1
Views: 377