Does a Companion object access private members of it’s Companion class in Scala?
Answer / 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 |
What is throw in scala?
Why do we need app in scala?
Explain bitset in scala?
What is a closure in Scala?
What do you mean by scala map?
What square measure implicit parameters in Scala?
What is the latest version of scala?
What is ‘scala trait’ in scala?
Does a Companion object access private members of it’s Companion class in Scala?
What is guard in Scala’s for-comprehension construct?
Mention the types of variables in scala?
What is a nexted function in scala?