I understand one of the main benefits from using object is, they are real objects instead of system wide functionality. But finally those objects are also system wide accessible.
Beside of being more "pure" what additional benefit does scala "objects" offer.
I bet there are a number but I can't really figure out which.
.
object X {
private[this] val z=1
}
class X {
import X._
//won't compile
println(z)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With