Does a Companion object access private members of it’s Companion class in Scala?
Answer Posted / Atish Kumar Paswan
No, by default, a Companion object cannot access private members of its Companion class in Scala. To allow access, the private members should be marked as 'private[this]', which restricts them to only the companion object and its enclosing class.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers