Scala error - error: not found: type -


i java developer trying learn class creation in scala.

i create 2 separate scala files. 1 file contains trait. second file extends trait , defines method.

cola.scala contains trait.

trait cola {         def fizz(): string } 

pepsi.scala has class tries extend trait.

class pepsi extends cola {         override def fizz():string = "1 sugar" }  var p = new pepsi println( " p = " + p.fizz ) 

when excecute "scala pepsi.scala" following error message:

 error: not found: type cola class pepsi extends cola 

both files in same folder.

please how resolve this? using scala 2.8 not using editor forced scratch. improve knowledge computers.

scala doesn't require put of traits , classes eponymous (that is, named same class) files. can put of in 1 file , work. or can specify both files on command line: scala not automatically cola in cola.scala.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -