0

Java supports public and package-private access modifier on the class level (Controlling Access to Members of a Class). What access modifier does Scala support for classes/objects access control?

The only documentation I can find mentions method level access control exclusively, any documentation that mentions class/object access control would be very helpful.

1
  • 1
    you can freely write code like private class Foo private(val bazz : Int). It would mean private to enclosing object class Foo with private constructor Commented Mar 11, 2016 at 17:23

2 Answers 2

1

You can use the same access modifiers for classes you use for methods.

Sign up to request clarification or add additional context in comments.

Comments

0

Here's a good blog post by Alvin Alexander that should help you answer those questions. More in-depth information on Classes & Objects is available in the Scala spec.

2 Comments

Unfortunately that post only discusses method level access control. It does not mention class/object level control.
@MikeRylander I've linked in the spec that speaks to Classes & Objects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.