class - Scala value not found - Stack Overflow
You need to either use the new keyword to create a new object, or add a companion object for your class Foo with an apply() method to create a new Foo object.
object Foo { def apply() = new Foo() } // This is short syntax for Foo.apply() val f = Foo() (Note: If you do this in the REPL, you'll need to use :paste to paste both the class and the object at the same time).
You can also make Foo a case class; when you do that, a companion object with apply method will be automatically created.
case class Foo val f = Foo()Read full article from class - Scala value not found - Stack Overflow
No comments:
Post a Comment