Reputation: 13088
In one of my Scala files I have
object DataObject {
def create(...) {
new DataObject(...)
}
}
private case class DataObject(...) { ... }
using a Factory pattern. Can I not give DataObject as a input parameter to
object myfunction { value(in: DataObject): Double = ??? }
? I get the error from IntelliJ that "Cannot resolve symbol DataObject". If I remove private
I don't get the error anymore, but I don't understand why I can't pass DataObject
with private
. I thought it is only about the constructor? Also what can I do to pass DataObject
afterall?
Upvotes: 0
Views: 41
Reputation: 37832
private case class DataObject(...) { ... }
makes the class private; If you want to make the constructor private:
case class DataObject private(...) { ... }
Upvotes: 2